-
Notifications
You must be signed in to change notification settings - Fork 713
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
[20903] DynamicData to JSON serializer #4780
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>
Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>
} | ||
else | ||
{ | ||
EPROSIMA_LOG_WARNING(XTYPES_UTILS, "Error encountered while performing DynamicData to JSON serialization."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove redundant warning or modify content so it's specific for this overload.
// Return loaned value | ||
ReturnCode_t ret_return_loan; | ||
if (RETCODE_OK != (ret_return_loan = data->return_loaned_value(st_data))) | ||
{ | ||
EPROSIMA_LOG_WARNING(XTYPES_UTILS, "Error encountered while returning loaned value."); | ||
} | ||
// Give priority to prior error if occurred | ||
if (RETCODE_OK != ret) | ||
{ | ||
return ret; | ||
} | ||
else | ||
{ | ||
return ret_return_loan; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any nicer way of doing this?
|
||
return json_serialize_member(data, type_member->get_id(), | ||
traits<DynamicType>::narrow<DynamicTypeImpl>( | ||
member_desc.type())->resolve_alias_enclosed_type()->get_kind(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extend DynamicTypeImpl to have a new attribute + getter for its enclosing type, so the recursive search is only done once.
Bitset inheritance has recently refactored, I would add coverage for this scenario. |
Description
This PR introduces a couple of utility functions meant to ease the transformation of a
DynamicData
to a digestible JSON object, which is dumped either to a user-provided output string or ostream. The resulting JSON objects can follow the OMG standard format (as in https://www.omg.org/spec/DDS-JSON/1.0/Beta1/PDF), or an alternative custom one.Tests remain to be implemented.
Contributor Checklist
versions.md
file (if applicable).Reviewer Checklist