diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/WAN/CMakeLists.txt b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/WAN/CMakeLists.txt index 6d4bf26cc..d5134b0e0 100644 --- a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/WAN/CMakeLists.txt +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/WAN/CMakeLists.txt @@ -19,16 +19,23 @@ set(TEST_NAME DDSTestWAN) +# Determine Fast DDS version +if ("${fastrtps_VERSION}" VERSION_LESS 2.13) + set(DDS_TYPES_VERSION "v1") +else() + set(DDS_TYPES_VERSION "v2") +endif() + set(TEST_SOURCES - DDSTestWAN.cpp - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorld.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldv1.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldCdrAux.ipp - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyed.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedv1.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedCdrAux.ipp - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx) +DDSTestWAN.cpp + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorld.cxx + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorldv1.cxx> + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorldCdrAux.ipp> + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorldPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyed.cxx + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyedv1.cxx> + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyedCdrAux.ipp> + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx) set(TEST_LIST end_to_end_discovery_server_WAN_communication_UDPv4 @@ -63,7 +70,7 @@ set(TEST_NEEDED_SOURCES ) set(TEST_EXTRA_HEADERS - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types) add_blackbox_executable( diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/CMakeLists.txt b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/CMakeLists.txt index d018c22aa..3a88eda1b 100644 --- a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/CMakeLists.txt +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/CMakeLists.txt @@ -19,16 +19,23 @@ set(TEST_NAME DDSTestLocal) +# Determine Fast DDS version +if ("${fastrtps_VERSION}" VERSION_LESS 2.13) + set(DDS_TYPES_VERSION "v1") +else() + set(DDS_TYPES_VERSION "v2") +endif() + set(TEST_SOURCES DDSTestLocal.cpp - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorld.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldv1.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldCdrAux.ipp - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyed.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedv1.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedCdrAux.ipp - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx) + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorld.cxx + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorldv1.cxx> + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorldCdrAux.ipp> + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorldPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyed.cxx + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyedv1.cxx> + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyedCdrAux.ipp> + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx) set(TEST_LIST end_to_end_local_communication @@ -45,8 +52,8 @@ set(TEST_NEEDED_SOURCES ) set(TEST_EXTRA_HEADERS - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed, + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed, ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types) add_blackbox_executable( @@ -65,14 +72,14 @@ set(TEST_NAME set(TEST_SOURCES DDSTestLocalDisposeKey.cpp - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorld.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldv1.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldCdrAux.ipp - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyed.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedv1.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedCdrAux.ipp - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx) + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorld.cxx + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorldv1.cxx> + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorldCdrAux.ipp> + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorldPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyed.cxx + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyedv1.cxx> + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyedCdrAux.ipp> + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx) set(TEST_LIST end_to_end_local_communication_key_dispose) @@ -81,7 +88,7 @@ set(TEST_NEEDED_SOURCES ) set(TEST_EXTRA_HEADERS - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed, + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed, ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types) add_blackbox_executable( diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp index 8312f2f45..9207f373b 100644 --- a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp @@ -111,7 +111,11 @@ DdsRouterConfiguration dds_test_simple_configuration( * The transient_local option changes the test behavior to verify that the communication is transient_local and all old data is sent * to Late Joiners. */ -template +#if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + template +#else + template +#endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 void test_local_communication( DdsRouterConfiguration ddsrouter_configuration, uint32_t samples_to_receive = DEFAULT_SAMPLES_TO_RECEIVE, @@ -130,7 +134,10 @@ void test_local_communication( // Create a message with size specified by repeating the same string MsgStruct msg; - MsgStructType type; + + #if FASTRTPS_VERSION_MAJOR >= 2 && FASTRTPS_VERSION_MINOR >= 13 + MsgStructType type; + #endif // if FASTRTPS_VERSION_MAJOR >= 2 && FASTRTPS_VERSION_MINOR >= 13 std::string msg_str; @@ -142,11 +149,21 @@ void test_local_communication( msg.message(msg_str); // Create DDS Publisher in domain 0 - TestPublisher publisher(type.m_isGetKeyDefined); + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + TestPublisher publisher(msg.isKeyDefined()); + #else + TestPublisher publisher(type.m_isGetKeyDefined); + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + ASSERT_TRUE(publisher.init(0)); // Create DDS Subscriber in domain 1 - TestSubscriber subscriber(type.m_isGetKeyDefined, transient_local); + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + TestSubscriber subscriber(msg.isKeyDefined(), transient_local); + #else + TestSubscriber subscriber(type.m_isGetKeyDefined, transient_local); + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + ASSERT_TRUE(subscriber.init(1, &msg, &samples_received)); // Create DdsRouter entity @@ -209,8 +226,14 @@ void test_local_communication( */ TEST(DDSTestLocal, end_to_end_local_communication) { - test::test_local_communication( - test::dds_test_simple_configuration()); + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + test::test_local_communication( + test::dds_test_simple_configuration()); + #else + test::test_local_communication( + test::dds_test_simple_configuration()); + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + } /** @@ -219,8 +242,13 @@ TEST(DDSTestLocal, end_to_end_local_communication) */ TEST(DDSTestLocal, end_to_end_local_communication_keyed) { - test::test_local_communication( - test::dds_test_simple_configuration()); + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + test::test_local_communication( + test::dds_test_simple_configuration()); + #else + test::test_local_communication( + test::dds_test_simple_configuration()); + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 } /** @@ -230,14 +258,24 @@ TEST(DDSTestLocal, end_to_end_local_communication_keyed) */ TEST(DDSTestLocal, end_to_end_local_communication_disable_dynamic_discovery) { - test::test_local_communication( - test::dds_test_simple_configuration(true)); + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + test::test_local_communication( + test::dds_test_simple_configuration(true)); + #else + test::test_local_communication( + test::dds_test_simple_configuration(true)); + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 } TEST(DDSTestLocal, end_to_end_local_communication_disable_dynamic_discovery_keyed) { - test::test_local_communication( - test::dds_test_simple_configuration(true)); + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + test::test_local_communication( + test::dds_test_simple_configuration(true)); + #else + test::test_local_communication( + test::dds_test_simple_configuration(true)); + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 } /** @@ -249,10 +287,17 @@ TEST(DDSTestLocal, end_to_end_local_communication_disable_dynamic_discovery_keye */ TEST(DDSTestLocal, end_to_end_local_communication_high_frequency) { - test::test_local_communication( - test::dds_test_simple_configuration(), - 1000, // wait for 1000 samples received - 0); // send it without waiting from one sample to the other + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + test::test_local_communication( + test::dds_test_simple_configuration(), + 1000, // wait for 1000 samples received + 0); // send it without waiting from one sample to the other + #else + test::test_local_communication( + test::dds_test_simple_configuration(), + 1000, // wait for 1000 samples received + 0); // send it without waiting from one sample to the other + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 } /** @@ -264,11 +309,19 @@ TEST(DDSTestLocal, end_to_end_local_communication_high_frequency) */ TEST(DDSTestLocal, end_to_end_local_communication_high_size) { - test::test_local_communication( - test::dds_test_simple_configuration(), - test::DEFAULT_SAMPLES_TO_RECEIVE, - test::DEFAULT_MILLISECONDS_PUBLISH_LOOP, - 10000); // 500K message size + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + test::test_local_communication( + test::dds_test_simple_configuration(), + test::DEFAULT_SAMPLES_TO_RECEIVE, + test::DEFAULT_MILLISECONDS_PUBLISH_LOOP, + 10000); // 500K message size + #else + test::test_local_communication( + test::dds_test_simple_configuration(), + test::DEFAULT_SAMPLES_TO_RECEIVE, + test::DEFAULT_MILLISECONDS_PUBLISH_LOOP, + 10000); // 500K message size + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 } /** @@ -282,11 +335,19 @@ TEST(DDSTestLocal, end_to_end_local_communication_high_size) */ TEST(DDSTestLocal, end_to_end_local_communication_high_throughput) { - test::test_local_communication( - test::dds_test_simple_configuration(), - 500, - 1, - 1000); // 50K message size + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + test::test_local_communication( + test::dds_test_simple_configuration(), + 500, + 1, + 1000); // 50K message size + #else + test::test_local_communication( + test::dds_test_simple_configuration(), + 500, + 1, + 1000); // 50K message size + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 } /** @@ -295,12 +356,21 @@ TEST(DDSTestLocal, end_to_end_local_communication_high_throughput) */ TEST(DDSTestLocal, end_to_end_local_communication_transient_local) { - test::test_local_communication( - test::dds_test_simple_configuration(), - test::DEFAULT_SAMPLES_TO_RECEIVE, - test::DEFAULT_MILLISECONDS_PUBLISH_LOOP, - test::DEFAULT_MESSAGE_SIZE, - true); + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + test::test_local_communication( + test::dds_test_simple_configuration(), + test::DEFAULT_SAMPLES_TO_RECEIVE, + test::DEFAULT_MILLISECONDS_PUBLISH_LOOP, + test::DEFAULT_MESSAGE_SIZE, + true); + #else + test::test_local_communication( + test::dds_test_simple_configuration(), + test::DEFAULT_SAMPLES_TO_RECEIVE, + test::DEFAULT_MILLISECONDS_PUBLISH_LOOP, + test::DEFAULT_MESSAGE_SIZE, + true); + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 } /** @@ -309,12 +379,21 @@ TEST(DDSTestLocal, end_to_end_local_communication_transient_local) */ TEST(DDSTestLocal, end_to_end_local_communication_transient_local_disable_dynamic_discovery) { - test::test_local_communication( - test::dds_test_simple_configuration(true, true), - test::DEFAULT_SAMPLES_TO_RECEIVE, - test::DEFAULT_MILLISECONDS_PUBLISH_LOOP, - test::DEFAULT_MESSAGE_SIZE, - true); + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + test::test_local_communication( + test::dds_test_simple_configuration(true, true), + test::DEFAULT_SAMPLES_TO_RECEIVE, + test::DEFAULT_MILLISECONDS_PUBLISH_LOOP, + test::DEFAULT_MESSAGE_SIZE, + true); + #else + test::test_local_communication( + test::dds_test_simple_configuration(true, true), + test::DEFAULT_SAMPLES_TO_RECEIVE, + test::DEFAULT_MILLISECONDS_PUBLISH_LOOP, + test::DEFAULT_MESSAGE_SIZE, + true); + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 } int main( diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocalDisposeKey.cpp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocalDisposeKey.cpp index 71a999e91..4402cf200 100644 --- a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocalDisposeKey.cpp +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocalDisposeKey.cpp @@ -98,7 +98,11 @@ void test_local_communication_key_dispose( // Create a message with size specified by repeating the same string HelloWorldKeyed msg; - HelloWorldKeyedPubSubType type; + + #if FASTRTPS_VERSION_MAJOR >= 2 && FASTRTPS_VERSION_MINOR >= 13 + HelloWorldKeyedPubSubType type; + #endif // if FASTRTPS_VERSION_MAJOR >= 2 && FASTRTPS_VERSION_MINOR >= 13 + std::string msg_str; // Add this string as many times as the msg size requires @@ -110,11 +114,21 @@ void test_local_communication_key_dispose( msg.id(666); // Create DDS Publisher in domain 0 - TestPublisher publisher(type.m_isGetKeyDefined); + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + TestPublisher publisher(msg.isKeyDefined()); + #else + TestPublisher publisher(type.m_isGetKeyDefined); + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + ASSERT_TRUE(publisher.init(0)); // Create DDS Subscriber in domain 1 - TestSubscriber subscriber(type.m_isGetKeyDefined); + #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + TestSubscriber subscriber(msg.isKeyDefined()); + #else + TestSubscriber subscriber(type.m_isGetKeyDefined); + #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + ASSERT_TRUE(subscriber.init(1, &msg, &samples_received)); // Create DdsRouter entity diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/repeater/CMakeLists.txt b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/repeater/CMakeLists.txt index 196c8a66a..74b399b79 100644 --- a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/repeater/CMakeLists.txt +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/repeater/CMakeLists.txt @@ -19,16 +19,23 @@ set(TEST_NAME DDSTestRepeater) +# Determine Fast DDS version +if ("${fastrtps_VERSION}" VERSION_LESS 2.13) + set(DDS_TYPES_VERSION "v1") +else() + set(DDS_TYPES_VERSION "v2") +endif() + set(TEST_SOURCES DDSTestRepeater.cpp - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorld.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldv1.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldCdrAux.ipp - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyed.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedv1.cxx - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedCdrAux.ipp - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx) + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorld.cxx + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorldv1.cxx> + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorldCdrAux.ipp> + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld/HelloWorldPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyed.cxx + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyedv1.cxx> + $<$:${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyedCdrAux.ipp> + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx) set(TEST_LIST repeater_initial_peers_communication_UDPv4 @@ -38,7 +45,7 @@ set(TEST_NEEDED_SOURCES ) set(TEST_EXTRA_HEADERS - ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/HelloWorld + ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types/${DDS_TYPES_VERSION}/HelloWorld ${PROJECT_SOURCE_DIR}/test/blackbox/ddsrouter_core/dds/types) add_blackbox_executable( diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp index 22592369b..940880203 100644 --- a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp @@ -47,8 +47,13 @@ #include #include -#include "HelloWorld/HelloWorldPubSubTypes.h" -#include "HelloWorldKeyed/HelloWorldKeyedPubSubTypes.h" +#if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + #include "v1/HelloWorld/HelloWorldPubSubTypes.h" + #include "v1/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.h" +#else + #include "v2/HelloWorld/HelloWorldPubSubTypes.h" + #include "v2/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.h" +#endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 namespace test { diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorld.cxx b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorld.cxx new file mode 100644 index 000000000..0c11980c4 --- /dev/null +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorld.cxx @@ -0,0 +1,207 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file HelloWorld.cpp + * This source file contains the 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 "HelloWorld.h" +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + +HelloWorld::HelloWorld() +{ + // m_index com.eprosima.idl.parser.typecode.PrimitiveTypeCode@1622f1b + m_index = 0; + // m_message com.eprosima.idl.parser.typecode.StringTypeCode@70e8f8e + m_message =""; + +} + +HelloWorld::~HelloWorld() +{ + + +} + +HelloWorld::HelloWorld(const HelloWorld &x) +{ + m_index = x.m_index; + m_message = x.m_message; +} + +HelloWorld::HelloWorld(HelloWorld &&x) +{ + m_index = x.m_index; + m_message = std::move(x.m_message); +} + +HelloWorld& HelloWorld::operator=(const HelloWorld &x) +{ + + m_index = x.m_index; + m_message = x.m_message; + + return *this; +} + +HelloWorld& HelloWorld::operator=(HelloWorld &&x) +{ + + m_index = x.m_index; + m_message = std::move(x.m_message); + + return *this; +} + +size_t HelloWorld::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 HelloWorld::getCdrSerializedSize(const HelloWorld& data, size_t current_alignment) +{ + (void)data; + size_t initial_alignment = current_alignment; + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.message().size() + 1; + + + return current_alignment - initial_alignment; +} + +void HelloWorld::serialize(eprosima::fastcdr::Cdr &scdr) const +{ + + scdr << m_index; + scdr << m_message; +} + +void HelloWorld::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 HelloWorld::index(uint32_t _index) +{ +m_index = _index; +} + +/*! + * @brief This function returns the value of member index + * @return Value of member index + */ +uint32_t HelloWorld::index() const +{ + return m_index; +} + +/*! + * @brief This function returns a reference to member index + * @return Reference to member index + */ +uint32_t& HelloWorld::index() +{ + return m_index; +} + +/*! + * @brief This function copies the value in member message + * @param _message New value to be copied in member message + */ +void HelloWorld::message(const std::string &_message) +{ +m_message = _message; +} + +/*! + * @brief This function moves the value in member message + * @param _message New value to be moved in member message + */ +void HelloWorld::message(std::string &&_message) +{ +m_message = std::move(_message); +} + +/*! + * @brief This function returns a constant reference to member message + * @return Constant reference to member message + */ +const std::string& HelloWorld::message() const +{ + return m_message; +} + +/*! + * @brief This function returns a reference to member message + * @return Reference to member message + */ +std::string& HelloWorld::message() +{ + return m_message; +} + +size_t HelloWorld::getKeyMaxCdrSerializedSize(size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + + + return current_align; +} + +bool HelloWorld::isKeyDefined() +{ + return false; +} + +void HelloWorld::serializeKey(eprosima::fastcdr::Cdr &scdr) const +{ + (void) scdr; + + +} diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorld.h b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorld.h new file mode 100644 index 000000000..fa8952126 --- /dev/null +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorld.h @@ -0,0 +1,219 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file HelloWorld.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _HELLOWORLD_H_ +#define _HELLOWORLD_H_ + +// TODO Poner en el contexto. + +#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 // 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(HelloWorld_SOURCE) +#define HelloWorld_DllAPI __declspec( dllexport ) +#else +#define HelloWorld_DllAPI __declspec( dllimport ) +#endif // HelloWorld_SOURCE +#else +#define HelloWorld_DllAPI +#endif // if defined(EPROSIMA_USER_DLL_EXPORT) +#else +#define HelloWorld_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +/*! + * @brief This class represents the structure HelloWorld defined by the user in the IDL file. + * @ingroup HELLOWORLD + */ +class HelloWorld +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport HelloWorld(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~HelloWorld(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object HelloWorld that will be copied. + */ + eProsima_user_DllExport HelloWorld( + const HelloWorld& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object HelloWorld that will be copied. + */ + eProsima_user_DllExport HelloWorld( + HelloWorld&& x); + + /*! + * @brief Copy assignment. + * @param x Reference to the object HelloWorld that will be copied. + */ + eProsima_user_DllExport HelloWorld& operator =( + const HelloWorld& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object HelloWorld that will be copied. + */ + eProsima_user_DllExport HelloWorld& operator =( + HelloWorld&& x); + + /*! + * @brief This function sets a value in member index + * @param _index New value for member index + */ + eProsima_user_DllExport void index( + uint32_t _index); + + /*! + * @brief This function returns the value of member index + * @return Value of member index + */ + eProsima_user_DllExport uint32_t index() const; + + /*! + * @brief This function returns a reference to member index + * @return Reference to member index + */ + eProsima_user_DllExport uint32_t& index(); + + /*! + * @brief This function copies the value in member message + * @param _message New value to be copied in member message + */ + eProsima_user_DllExport void message( + const std::string& _message); + + /*! + * @brief This function moves the value in member message + * @param _message New value to be moved in member message + */ + eProsima_user_DllExport void message( + std::string&& _message); + + /*! + * @brief This function returns a constant reference to member message + * @return Constant reference to member message + */ + eProsima_user_DllExport const std::string& message() const; + + /*! + * @brief This function returns a reference to member message + * @return Reference to member message + */ + eProsima_user_DllExport std::string& message(); + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize( + size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize( + const HelloWorld& data, + size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr); + + + + /*! + * @brief This function 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 // _HELLOWORLD_H_ diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorld.idl b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorld.idl similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorld.idl rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorld.idl diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorldPubSubTypes.cxx b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorldPubSubTypes.cxx new file mode 100644 index 000000000..2d244fa11 --- /dev/null +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorldPubSubTypes.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 HelloWorldPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include "HelloWorldPubSubTypes.h" + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +HelloWorldPubSubType::HelloWorldPubSubType() +{ + setName("HelloWorld"); + m_typeSize = static_cast(HelloWorld::getMaxCdrSerializedSize()) + 4 /*encapsulation*/; + m_isGetKeyDefined = HelloWorld::isKeyDefined(); + size_t keyLength = HelloWorld::getKeyMaxCdrSerializedSize()>16 ? HelloWorld::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); +} + +HelloWorldPubSubType::~HelloWorldPubSubType() +{ + if(m_keyBuffer!=nullptr) + free(m_keyBuffer); +} + +bool HelloWorldPubSubType::serialize(void *data, SerializedPayload_t *payload) +{ + HelloWorld *p_type = static_cast(data); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); // Object that manages the raw buffer. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, + eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + p_type->serialize(ser); // Serialize the object: + } + catch(eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + payload->length = static_cast(ser.getSerializedDataLength()); //Get the serialized length + return true; +} + +bool HelloWorldPubSubType::deserialize(SerializedPayload_t* payload, void* data) +{ + HelloWorld* p_type = static_cast(data); //Convert DATA to pointer of your type + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); // Object that manages the raw buffer. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, + eprosima::fastcdr::Cdr::DDS_CDR); // Object that deserializes the data. + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + try + { + p_type->deserialize(deser); //Deserialize the object: + } + catch(eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; +} + +std::function HelloWorldPubSubType::getSerializedSizeProvider(void* data) +{ + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + 4 /*encapsulation*/; + }; +} + +void* HelloWorldPubSubType::createData() +{ + return reinterpret_cast(new HelloWorld()); +} + +void HelloWorldPubSubType::deleteData(void* data) +{ + delete(reinterpret_cast(data)); +} + +bool HelloWorldPubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) +{ + if(!m_isGetKeyDefined) + return false; + HelloWorld* p_type = static_cast(data); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer),HelloWorld::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data. + p_type->serializeKey(ser); + if(force_md5 || HelloWorld::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/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorldPubSubTypes.h b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorldPubSubTypes.h new file mode 100644 index 000000000..3fd9b2c65 --- /dev/null +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorld/HelloWorldPubSubTypes.h @@ -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 HelloWorldPubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _HELLOWORLD_PUBSUBTYPES_H_ +#define _HELLOWORLD_PUBSUBTYPES_H_ + +#include +#include + +#include "HelloWorld.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error Generated HelloWorld is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // if !defined(GEN_API_VER) || (GEN_API_VER != 1) + +/*! + * @brief This class represents the TopicDataType of the type HelloWorld defined by the user in the IDL file. + * @ingroup HELLOWORLD + */ +class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef HelloWorld type; + + eProsima_user_DllExport HelloWorldPubSubType(); + + eProsima_user_DllExport virtual ~HelloWorldPubSubType(); + 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; + MD5 m_md5; + unsigned char* m_keyBuffer; +}; + +#endif // _HELLOWORLD_PUBSUBTYPES_H_ diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyed.cxx b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyed.cxx new file mode 100644 index 000000000..cb524dfd7 --- /dev/null +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyed.cxx @@ -0,0 +1,283 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file HelloWorldKeyed.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 "HelloWorldKeyed.h" +#include + +#include +using namespace eprosima::fastcdr::exception; + +#include + +HelloWorldKeyed::HelloWorldKeyed() +{ + // m_id com.eprosima.idl.parser.typecode.PrimitiveTypeCode@77a57272 + m_id = 0; + // m_index com.eprosima.idl.parser.typecode.PrimitiveTypeCode@7181ae3f + m_index = 0; + // m_message com.eprosima.idl.parser.typecode.StringTypeCode@46238e3f + m_message =""; + +} + +HelloWorldKeyed::~HelloWorldKeyed() +{ + + + +} + +HelloWorldKeyed::HelloWorldKeyed( + const HelloWorldKeyed& x) +{ + m_id = x.m_id; + m_index = x.m_index; + m_message = x.m_message; +} + +HelloWorldKeyed::HelloWorldKeyed( + HelloWorldKeyed&& x) +{ + m_id = x.m_id; + m_index = x.m_index; + m_message = std::move(x.m_message); +} + +HelloWorldKeyed& HelloWorldKeyed::operator =( + const HelloWorldKeyed& x) +{ + + m_id = x.m_id; + m_index = x.m_index; + m_message = x.m_message; + + return *this; +} + +HelloWorldKeyed& HelloWorldKeyed::operator =( + HelloWorldKeyed&& x) +{ + + m_id = x.m_id; + m_index = x.m_index; + m_message = std::move(x.m_message); + + return *this; +} + +bool HelloWorldKeyed::operator ==( + const HelloWorldKeyed& x) const +{ + + return (m_id == x.m_id && m_index == x.m_index && m_message == x.m_message); +} + +bool HelloWorldKeyed::operator !=( + const HelloWorldKeyed& x) const +{ + return !(*this == x); +} + +size_t HelloWorldKeyed::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); + + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + + + return current_alignment - initial_alignment; +} + +size_t HelloWorldKeyed::getCdrSerializedSize( + const HelloWorldKeyed& 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.message().size() + 1; + + + return current_alignment - initial_alignment; +} + +void HelloWorldKeyed::serialize( + eprosima::fastcdr::Cdr& scdr) const +{ + + scdr << m_id; + scdr << m_index; + scdr << m_message; + +} + +void HelloWorldKeyed::deserialize( + eprosima::fastcdr::Cdr& dcdr) +{ + + dcdr >> m_id; + dcdr >> m_index; + dcdr >> m_message; +} + +/*! + * @brief This function sets a value in member id + * @param _id New value for member id + */ +void HelloWorldKeyed::id( + int32_t _id) +{ + m_id = _id; +} + +/*! + * @brief This function returns the value of member id + * @return Value of member id + */ +int32_t HelloWorldKeyed::id() const +{ + return m_id; +} + +/*! + * @brief This function returns a reference to member id + * @return Reference to member id + */ +int32_t& HelloWorldKeyed::id() +{ + return m_id; +} + +/*! + * @brief This function sets a value in member index + * @param _index New value for member index + */ +void HelloWorldKeyed::index( + uint32_t _index) +{ + m_index = _index; +} + +/*! + * @brief This function returns the value of member index + * @return Value of member index + */ +uint32_t HelloWorldKeyed::index() const +{ + return m_index; +} + +/*! + * @brief This function returns a reference to member index + * @return Reference to member index + */ +uint32_t& HelloWorldKeyed::index() +{ + return m_index; +} + +/*! + * @brief This function copies the value in member message + * @param _message New value to be copied in member message + */ +void HelloWorldKeyed::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 HelloWorldKeyed::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& HelloWorldKeyed::message() const +{ + return m_message; +} + +/*! + * @brief This function returns a reference to member message + * @return Reference to member message + */ +std::string& HelloWorldKeyed::message() +{ + return m_message; +} + +size_t HelloWorldKeyed::getKeyMaxCdrSerializedSize( + size_t current_alignment) +{ + size_t current_align = current_alignment; + + + current_align += 4 + eprosima::fastcdr::Cdr::alignment(current_align, 4); + + + + + + return current_align; +} + +bool HelloWorldKeyed::isKeyDefined() +{ + return true; +} + +void HelloWorldKeyed::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; + scdr << m_id; + +} diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyed.h b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyed.h new file mode 100644 index 000000000..4e5e9f11c --- /dev/null +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyed.h @@ -0,0 +1,252 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file HelloWorldKeyed.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_HELLOWORLDKEYED_H_ +#define _FAST_DDS_GENERATED_HELLOWORLDKEYED_H_ + + +#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(HelloWorldKeyed_SOURCE) +#define HelloWorldKeyed_DllAPI __declspec( dllexport ) +#else +#define HelloWorldKeyed_DllAPI __declspec( dllimport ) +#endif // HelloWorldKeyed_SOURCE +#else +#define HelloWorldKeyed_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define HelloWorldKeyed_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + +/*! + * @brief This class represents the structure HelloWorldKeyed defined by the user in the IDL file. + * @ingroup HELLOWORLDKEYED + */ +class HelloWorldKeyed +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport HelloWorldKeyed(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~HelloWorldKeyed(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object HelloWorldKeyed that will be copied. + */ + eProsima_user_DllExport HelloWorldKeyed( + const HelloWorldKeyed& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object HelloWorldKeyed that will be copied. + */ + eProsima_user_DllExport HelloWorldKeyed( + HelloWorldKeyed&& x); + + /*! + * @brief Copy assignment. + * @param x Reference to the object HelloWorldKeyed that will be copied. + */ + eProsima_user_DllExport HelloWorldKeyed& operator =( + const HelloWorldKeyed& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object HelloWorldKeyed that will be copied. + */ + eProsima_user_DllExport HelloWorldKeyed& operator =( + HelloWorldKeyed&& x); + + /*! + * @brief Comparison operator. + * @param x HelloWorldKeyed object to compare. + */ + eProsima_user_DllExport bool operator ==( + const HelloWorldKeyed& x) const; + + /*! + * @brief Comparison operator. + * @param x HelloWorldKeyed object to compare. + */ + eProsima_user_DllExport bool operator !=( + const HelloWorldKeyed& x) const; + + /*! + * @brief This function sets a value in member id + * @param _id New value for member id + */ + eProsima_user_DllExport void id( + int32_t _id); + + /*! + * @brief This function returns the value of member id + * @return Value of member id + */ + eProsima_user_DllExport int32_t id() const; + + /*! + * @brief This function returns a reference to member id + * @return Reference to member id + */ + eProsima_user_DllExport int32_t& id(); + + /*! + * @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 HelloWorldKeyed& 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_id; + uint32_t m_index; + std::string m_message; +}; + +#endif // _FAST_DDS_GENERATED_HELLOWORLDKEYED_H_ diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyed.idl b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyed.idl similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyed.idl rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyed.idl diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx new file mode 100644 index 000000000..ee604cbba --- /dev/null +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx @@ -0,0 +1,169 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file HelloWorldKeyedPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#include +#include + +#include "HelloWorldKeyedPubSubTypes.h" + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + +HelloWorldKeyedPubSubType::HelloWorldKeyedPubSubType() +{ + setName("HelloWorldKeyed"); + auto type_size = HelloWorldKeyed::getMaxCdrSerializedSize(); + type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ + m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ + m_isGetKeyDefined = HelloWorldKeyed::isKeyDefined(); + size_t keyLength = HelloWorldKeyed::getKeyMaxCdrSerializedSize() > 16 ? + HelloWorldKeyed::getKeyMaxCdrSerializedSize() : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); +} + +HelloWorldKeyedPubSubType::~HelloWorldKeyedPubSubType() +{ + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } +} + +bool HelloWorldKeyedPubSubType::serialize( + void* data, + SerializedPayload_t* payload) +{ + HelloWorldKeyed* 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 HelloWorldKeyedPubSubType::deserialize( + SerializedPayload_t* payload, + void* data) +{ + //Convert DATA to pointer of your type + HelloWorldKeyed* 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; + + try + { + // Deserialize the object. + p_type->deserialize(deser); + } + catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; +} + +std::function HelloWorldKeyedPubSubType::getSerializedSizeProvider( + void* data) +{ + return [data]() -> uint32_t + { + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; + }; +} + +void* HelloWorldKeyedPubSubType::createData() +{ + return reinterpret_cast(new HelloWorldKeyed()); +} + +void HelloWorldKeyedPubSubType::deleteData( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool HelloWorldKeyedPubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) +{ + if (!m_isGetKeyDefined) + { + return false; + } + + HelloWorldKeyed* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + HelloWorldKeyed::getKeyMaxCdrSerializedSize()); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); + p_type->serializeKey(ser); + if (force_md5 || HelloWorldKeyed::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/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.h b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.h new file mode 100644 index 000000000..09f22ef99 --- /dev/null +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v1/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.h @@ -0,0 +1,101 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file HelloWorldKeyedPubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _FAST_DDS_GENERATED_HELLOWORLDKEYED_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_HELLOWORLDKEYED_PUBSUBTYPES_H_ + +#include +#include + +#include "HelloWorldKeyed.h" + +#if !defined(GEN_API_VER) || (GEN_API_VER != 1) +#error \ + Generated HelloWorldKeyed 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 HelloWorldKeyed defined by the user in the IDL file. + * @ingroup HELLOWORLDKEYED + */ +class HelloWorldKeyedPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef HelloWorldKeyed type; + + eProsima_user_DllExport HelloWorldKeyedPubSubType(); + + eProsima_user_DllExport virtual ~HelloWorldKeyedPubSubType(); + + 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_HELLOWORLDKEYED_PUBSUBTYPES_H_ diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorld.cxx b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorld.cxx similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorld.cxx rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorld.cxx diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorld.h b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorld.h similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorld.h rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorld.h diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorld.idl b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorld.idl new file mode 100644 index 000000000..0fd2c355a --- /dev/null +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorld.idl @@ -0,0 +1,5 @@ +struct HelloWorld +{ + unsigned long index; + string message; +}; diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldCdrAux.hpp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorldCdrAux.hpp similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldCdrAux.hpp rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorldCdrAux.hpp diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldCdrAux.ipp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorldCdrAux.ipp similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldCdrAux.ipp rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorldCdrAux.ipp diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldPubSubTypes.cxx b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorldPubSubTypes.cxx similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldPubSubTypes.cxx rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorldPubSubTypes.cxx diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldPubSubTypes.h b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorldPubSubTypes.h similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldPubSubTypes.h rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorldPubSubTypes.h diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldv1.cxx b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorldv1.cxx similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldv1.cxx rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorldv1.cxx diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldv1.h b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorldv1.h similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorld/HelloWorldv1.h rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorld/HelloWorldv1.h diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyed.cxx b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyed.cxx similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyed.cxx rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyed.cxx diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyed.h b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyed.h similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyed.h rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyed.h diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyed.idl b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyed.idl new file mode 100644 index 000000000..6cebe626d --- /dev/null +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyed.idl @@ -0,0 +1,6 @@ +struct HelloWorldKeyed +{ + @Key long id; + unsigned long index; + string message; +}; diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedCdrAux.hpp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyedCdrAux.hpp similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedCdrAux.hpp rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyedCdrAux.hpp diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedCdrAux.ipp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyedCdrAux.ipp similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedCdrAux.ipp rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyedCdrAux.ipp diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.cxx diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.h b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.h similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.h rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyedPubSubTypes.h diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedv1.cxx b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyedv1.cxx similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedv1.cxx rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyedv1.cxx diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedv1.h b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyedv1.h similarity index 100% rename from ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/HelloWorldKeyed/HelloWorldKeyedv1.h rename to ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/v2/HelloWorldKeyed/HelloWorldKeyedv1.h