Skip to content

Commit

Permalink
Revamp of rmw_context_impl_s (#307)
Browse files Browse the repository at this point in the history
* Make rmw_context_impl_s::Data private.

That way we can completely hide the implementation in
rmw_context_impl_s.cpp.

Signed-off-by: Chris Lalancette <[email protected]>

* Remove subscribe_to_ros_graph method.

We can just do this work right in the constructor, which
simplifies it.

Signed-off-by: Chris Lalancette <[email protected]>

* Remove unused is_initialized_ member.

Signed-off-by: Chris Lalancette <[email protected]>

* Remove unused allocator member.

Signed-off-by: Chris Lalancette <[email protected]>

* Stop storing the liveliness_str.

We only need it during construction, so only use it
there.

Signed-off-by: Chris Lalancette <[email protected]>

* Make struct Data "final".

Signed-off-by: Chris Lalancette <[email protected]>

* Keep the Data members around while they are being used.

What we do here is to create a global map between a
Data pointer, and its shared_ptr equivalent.  When we
create a new Data ptr via rmw_context_impl_s, we add
it to the map.  When we delete a Data ptr via rmw_context_impl_s,
we remove it from the map.  When we get a graph callback,
we look to see if the pointer is in the map; if so, we
get the shared_ptr.  Because of this, we are guaranteed
that the Data pointer will not be removed while we are
using it.

Signed-off-by: Chris Lalancette <[email protected]>

* Revamp Data and rmw_context_impl_s.

In particular, since all of the data is owned by
Data, move all of the functionality into there as well.
Then it is clear who owns all of it, instead of it being
split across rmw_context_impl_s and Data.

Signed-off-by: Chris Lalancette <[email protected]>

* Feedback from review.

Signed-off-by: Chris Lalancette <[email protected]>

* Feedback from review.

Signed-off-by: Chris Lalancette <[email protected]>

* Style.

Signed-off-by: Chris Lalancette <[email protected]>

---------

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Nov 12, 2024
1 parent fbdd17a commit 00d8554
Show file tree
Hide file tree
Showing 2 changed files with 430 additions and 386 deletions.
Loading

0 comments on commit 00d8554

Please sign in to comment.