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

[21392] Refactor key hash calculation according to DDS X-Types 1.3 #381

Merged
merged 7 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ bool $struct.name$PubSubType::compute_key(
$struct.cScopedname$_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 || $struct.cScopedname$_max_key_cdr_typesize > 16)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,26 +151,55 @@ void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const $struct.scopedname$& data)
{
$if(!struct.inheritance)$
$if(!struct.scope.empty)$
using namespace $struct.scope$;
$endif$
$struct.membersById : { member |
$if(member.typecode.isStructType)$
extern void serialize_key(
Cdr& scdr,
const $member.typecode.scopedname$& data);
$endif$
}; separator="\n"$

static_cast<void>(scdr);
static_cast<void>(data);
$if(struct.hasKey)$
$struct.members : { member |
$struct.membersById : { member |
$if(member.annotationKey)$
$if(member.typecode.isStructType)$
$if(member.typecode.hasKey)$
serialize_key(scdr, data.$member.name$());
$else$
scdr << data.$member.name$();
$endif$
$else$
scdr << data.$member.name$();
$endif$
$if(member.typecode.isStructType)$
serialize_key(scdr, data.$member.name$());
$else$
scdr << data.$member.name$();
$endif$
$endif$
}; separator="\n"$
$else$
$struct.membersById : { member |
$if(member.annotationOptional)$
if (data.$member.name$().has_value())
{
$if(member.typecode.isStructType)$
serialize_key(scdr, data.$member.name$().value());
$else$
scdr << data.$member.name$().value();
$endif$
\}
$else$
$if(member.typecode.isStructType)$
serialize_key(scdr, data.$member.name$());
$else$
scdr << data.$member.name$();
$endif$
$endif$
}; separator="\n"$
$endif$
$else$
extern void serialize_key(
Cdr& scdr,
const $struct.inheritance.scopedname$& data);
serialize_key(scdr, static_cast<const $struct.inheritance.scopedname$&>(data));
MiguelCompany marked this conversation as resolved.
Show resolved Hide resolved
$endif$
}

Expand Down
2 changes: 1 addition & 1 deletion thirdparty/dds-types-test
Submodule dds-types-test updated 1 files
+24 −0 IDL/key.idl
Loading