Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21393] Add new tests for testing new key hash calculation according to DDS-XTypes 1.3 #5091

Merged
merged 9 commits into from
Aug 2, 2024
7 changes: 7 additions & 0 deletions examples/cpp/configuration/ConfigurationCdrAux.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,15 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const Configuration& data)
{

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.index();

scdr << data.message();

scdr << data.data();

}


Expand Down
3 changes: 2 additions & 1 deletion examples/cpp/configuration/ConfigurationPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ bool ConfigurationPubSubType::compute_key(
Configuration_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 || Configuration_max_key_cdr_typesize > 16)
{
Expand Down
5 changes: 5 additions & 0 deletions examples/cpp/content_filter/HelloWorldCdrAux.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const HelloWorld& data)
{

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.index();

scdr << data.message();

}


Expand Down
3 changes: 2 additions & 1 deletion examples/cpp/content_filter/HelloWorldPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ bool HelloWorldPubSubType::compute_key(
HelloWorld_max_key_cdr_typesize);

// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1);
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || HelloWorld_max_key_cdr_typesize > 16)
{
Expand Down
5 changes: 5 additions & 0 deletions examples/cpp/custom_payload_pool/HelloWorldCdrAux.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const HelloWorld& data)
{

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.index();

scdr << data.message();

}


Expand Down
3 changes: 2 additions & 1 deletion examples/cpp/custom_payload_pool/HelloWorldPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ bool HelloWorldPubSubType::compute_key(
HelloWorld_max_key_cdr_typesize);

// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1);
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || HelloWorld_max_key_cdr_typesize > 16)
{
Expand Down
5 changes: 5 additions & 0 deletions examples/cpp/delivery_mechanisms/DeliveryMechanismsCdrAux.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const DeliveryMechanisms& data)
{

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.index();

scdr << data.message();

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ bool DeliveryMechanismsPubSubType::compute_key(
DeliveryMechanisms_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 || DeliveryMechanisms_max_key_cdr_typesize > 16)
{
Expand Down
5 changes: 5 additions & 0 deletions examples/cpp/discovery_server/HelloWorldCdrAux.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const HelloWorld& data)
{

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.index();

scdr << data.message();

}


Expand Down
3 changes: 2 additions & 1 deletion examples/cpp/discovery_server/HelloWorldPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ bool HelloWorldPubSubType::compute_key(
HelloWorld_max_key_cdr_typesize);

// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1);
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || HelloWorld_max_key_cdr_typesize > 16)
{
Expand Down
5 changes: 5 additions & 0 deletions examples/cpp/flow_control/FlowControlCdrAux.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const FlowControl& data)
{

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.index();

scdr << data.message();

}


Expand Down
3 changes: 2 additions & 1 deletion examples/cpp/flow_control/FlowControlPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ bool FlowControlPubSubType::compute_key(
FlowControl_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 || FlowControl_max_key_cdr_typesize > 16)
{
Expand Down
5 changes: 5 additions & 0 deletions examples/cpp/hello_world/HelloWorldCdrAux.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const HelloWorld& data)
{

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.index();

scdr << data.message();

}


Expand Down
3 changes: 2 additions & 1 deletion examples/cpp/hello_world/HelloWorldPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ bool HelloWorldPubSubType::compute_key(
HelloWorld_max_key_cdr_typesize);

// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1);
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || HelloWorld_max_key_cdr_typesize > 16)
{
Expand Down
6 changes: 4 additions & 2 deletions examples/cpp/request_reply/types/CalculatorCdrAux.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const CalculatorRequestType& data)
{

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.client_id();
scdr << data.client_id();



Expand Down Expand Up @@ -218,9 +219,10 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const CalculatorReplyType& data)
{

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.client_id();
scdr << data.client_id();


}
Expand Down
6 changes: 4 additions & 2 deletions examples/cpp/request_reply/types/CalculatorPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ bool CalculatorRequestTypePubSubType::compute_key(
CalculatorRequestType_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 || CalculatorRequestType_max_key_cdr_typesize > 16)
{
Expand Down Expand Up @@ -364,7 +365,8 @@ bool CalculatorReplyTypePubSubType::compute_key(
CalculatorReplyType_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 || CalculatorReplyType_max_key_cdr_typesize > 16)
{
Expand Down
5 changes: 5 additions & 0 deletions examples/cpp/security/HelloWorldCdrAux.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const HelloWorld& data)
{

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.index();

scdr << data.message();

}


Expand Down
3 changes: 2 additions & 1 deletion examples/cpp/security/HelloWorldPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ bool HelloWorldPubSubType::compute_key(
HelloWorld_max_key_cdr_typesize);

// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1);
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || HelloWorld_max_key_cdr_typesize > 16)
{
Expand Down
5 changes: 5 additions & 0 deletions examples/cpp/static_edp_discovery/HelloWorldCdrAux.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const HelloWorld& data)
{

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.index();

scdr << data.message();

}


Expand Down
3 changes: 2 additions & 1 deletion examples/cpp/static_edp_discovery/HelloWorldPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ bool HelloWorldPubSubType::compute_key(
HelloWorld_max_key_cdr_typesize);

// Object that serializes the data.
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1);
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
eprosima::fastcdr::serialize_key(ser, *p_type);
if (force_md5 || HelloWorld_max_key_cdr_typesize > 16)
{
Expand Down
3 changes: 2 additions & 1 deletion examples/cpp/topic_instances/ShapeTypeCdrAux.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const ShapeType& data)
{

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.color();
scdr << data.color();



Expand Down
3 changes: 2 additions & 1 deletion examples/cpp/topic_instances/ShapeTypePubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ bool ShapeTypePubSubType::compute_key(
ShapeType_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 || ShapeType_max_key_cdr_typesize > 16)
{
Expand Down
4 changes: 3 additions & 1 deletion include/fastdds/rtps/common/InstanceHandle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ namespace eprosima {
namespace fastdds {
namespace rtps {

using KeyHash_t = std::array<octet, 16>;
constexpr const uint8_t RTPS_KEY_HASH_SIZE = 16;

using KeyHash_t = std::array<octet, RTPS_KEY_HASH_SIZE>;

struct FASTDDS_EXPORTED_API InstanceHandleValue_t
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ void serialize_key(

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.type_ids();

}


Expand Down Expand Up @@ -207,6 +209,10 @@ void serialize_key(

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.types();

scdr << data.complete_to_minimal();

}


Expand Down Expand Up @@ -414,6 +420,10 @@ void serialize_key(

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.continuation_point();

scdr << data.type_ids();

}


Expand Down Expand Up @@ -506,6 +516,10 @@ void serialize_key(

static_cast<void>(scdr);
static_cast<void>(data);
scdr << data.continuation_point();

scdr << data.dependent_typeids();

}


Expand Down Expand Up @@ -846,9 +860,18 @@ void serialize_key(
const eprosima::fastdds::dds::builtin::TypeLookup_Request& data)
{
using namespace eprosima::fastdds::dds::builtin;
extern void serialize_key(
Cdr& scdr,
const eprosima::fastdds::dds::rpc::RequestHeader& data);



static_cast<void>(scdr);
static_cast<void>(data);
serialize_key(scdr, data.header());

scdr << data.data();

}


Expand Down Expand Up @@ -1074,9 +1097,18 @@ void serialize_key(
const eprosima::fastdds::dds::builtin::TypeLookup_Reply& data)
{
using namespace eprosima::fastdds::dds::builtin;
extern void serialize_key(
Cdr& scdr,
const eprosima::fastdds::dds::rpc::ReplyHeader& data);



static_cast<void>(scdr);
static_cast<void>(data);
serialize_key(scdr, data.header());

scdr << data.return_value();

}


Expand Down
Loading
Loading