-
Notifications
You must be signed in to change notification settings - Fork 15
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
Update repository for Fast DDS 3.0.0 compatibility #141
Conversation
Signed-off-by: Lucia Echevarria <[email protected]>
Signed-off-by: Lucia Echevarria <[email protected]>
Signed-off-by: Lucia Echevarria <[email protected]>
…d fix bugs Signed-off-by: Lucia Echevarria <[email protected]>
#include <fastrtps/types/DynamicDataFactory.h> | ||
#include <fastrtps/types/TypeObjectFactory.h> | ||
#include <fastdds/dds/xtypes/dynamic_types/DynamicData.hpp> | ||
#include <fastdds/dds/xtypes/dynamic_types/DynamicType.hpp> |
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.
This tests need to be fixed
// Set as server in TypeLookup service | ||
pqos.wire_protocol().builtin.typelookup_config.use_client = false; | ||
pqos.wire_protocol().builtin.typelookup_config.use_server = true; | ||
|
||
// Participant creation via factory |
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.
Comment for the reviewer: The dyn_participant_
has been removed from the Replayer. Its sole purpose was to manage the DynamicTypes
, but now this responsibility has been transferred to the participants within the DDSPipe
.
Signed-off-by: Lucia Echevarria <[email protected]>
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.
Looking good! Thanks for the hard work. Everything looks much cleaner now.
else() | ||
set(DDS_TYPES_VERSION "v2") | ||
endif() | ||
|
||
file( |
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.
I believe manually selecting the SOURCE_FILES
is no longer required. We can do it as it was being done before b388f09. Take a look at https://github.com/eProsima/DDS-Record-Replay/blob/11fcf5c89dbad7e5ad8c9f1ee37e9577abe5ae00/ddsrecorder/CMakeLists.txt.
#include <cpp_utils/macros/custom_enumeration.hpp> | ||
|
||
#include <ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp> | ||
#include <string> |
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.
Maybe we should include <memory>
as well, to support shared_ptr
.
@@ -498,19 +368,28 @@ fastrtps::types::TypeIdentifier DdsReplayer::deserialize_type_identifier_( | |||
fastcdr::FastBuffer fastbuffer((char*)payload.data, parameter_length); | |||
|
|||
// Read data | |||
fastrtps::rtps::CDRMessage::readData(cdr_message, payload.data, parameter_length); | |||
if (cdr_message != nullptr) |
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.
Avoid nested ifs. Use &s.
@@ -540,19 +419,28 @@ fastrtps::types::TypeObject DdsReplayer::deserialize_type_object_( | |||
fastcdr::FastBuffer fastbuffer((char*)payload.data, parameter_length); | |||
|
|||
// Read data | |||
fastrtps::rtps::CDRMessage::readData(cdr_message, payload.data, parameter_length); | |||
if (cdr_message != nullptr) |
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.
Use &s here as well.
"Failed to create {" << topic->m_topic_name << ";" << topic->type_name << | ||
"} DDS topic, aborting dynamic writer creation..."); | ||
return; | ||
registered_types_.insert({dynamic_type.type_name(), type_identifiers}); |
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.
We usually add data to a map like:
registered_types[dynamic_type.type_name()] = type_identifiers;
const uint32_t size_octet = sizeof(value); | ||
if (!(cdr_message && (cdr_message->pos + size_octet <= cdr_message->max_size))) | ||
{ | ||
// TODO Warning |
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.
I think the code would also be more readable if you continue
at the end of the if to avoid the else
.
|
||
// Add data | ||
bool valid = fastrtps::rtps::CDRMessage::addData(cdr_message, payload.data, payload.length); | ||
if (!(cdr_message && (cdr_message->pos + payload.length <= cdr_message->max_size))|| (payload.length > 0 && !payload.data)) |
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.
The same goes for this expression. It would be more readable if you untie it:
!cdr_message || cdr_message->pos + payload.length > cdr_message->max_size || (payload.length > 0 && !payload.data)
|
||
// Add data | ||
bool valid = fastrtps::rtps::CDRMessage::addData(cdr_message, payload.data, payload.length); | ||
if (!(cdr_message && (cdr_message->pos + payload.length <= cdr_message->max_size))|| (payload.length > 0 && !payload.data)) |
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.
Furthermore, I'm not an expert on Dynamic Types, but this looks like two different expressions for which you may want to throw two different warnings.
#endif // if __BIG_ENDIAN__ | ||
|
||
// Create CDR message with payload | ||
fastrtps::rtps::CDRMessage_t* cdr_message = new fastrtps::rtps::CDRMessage_t(payload); |
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.
Can this be const
?
|
||
// Add data | ||
bool valid = fastrtps::rtps::CDRMessage::addData(cdr_message, payload.data, payload.length); | ||
if (!(cdr_message && (cdr_message->pos + payload.length <= cdr_message->max_size))|| (payload.length > 0 && !payload.data)) |
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.
Please apply as well my comments below.
Signed-off-by: Lucia Echevarria <[email protected]>
Signed-off-by: Lucia Echevarria <[email protected]>
Closed in favor of #148 |
Merge after: