refactor to use a std::tuple and be immutable#1
Merged
methylDragon merged 2 commits intomethylDragon:ch3/node-handlefrom Dec 14, 2022
Merged
refactor to use a std::tuple and be immutable#1methylDragon merged 2 commits intomethylDragon:ch3/node-handlefrom
methylDragon merged 2 commits intomethylDragon:ch3/node-handlefrom
Conversation
Signed-off-by: William Woodall <william@osrfoundation.org>
Comment on lines
+140
to
+177
| auto base = ni.get<NodeBaseInterface>(); | ||
| base = ni.get_node_base_interface(); | ||
| } | ||
| { | ||
| auto clock = ni.get<NodeClockInterface>(); | ||
| clock = ni.get_node_clock_interface(); | ||
| } | ||
| { | ||
| auto graph = ni.get<NodeGraphInterface>(); | ||
| graph = ni.get_node_graph_interface(); | ||
| } | ||
| { | ||
| auto logging = ni.get<NodeLoggingInterface>(); | ||
| logging = ni.get_node_logging_interface(); | ||
| } | ||
| { | ||
| auto timers = ni.get<NodeTimersInterface>(); | ||
| timers = ni.get_node_timers_interface(); | ||
| } | ||
| { | ||
| auto topics = ni.get<NodeTopicsInterface>(); | ||
| topics = ni.get_node_topics_interface(); | ||
| } | ||
| { | ||
| auto services = ni.get<NodeServicesInterface>(); | ||
| services = ni.get_node_services_interface(); | ||
| } | ||
| { | ||
| auto waitables = ni.get<NodeWaitablesInterface>(); | ||
| waitables = ni.get_node_waitables_interface(); | ||
| } | ||
| { | ||
| auto parameters = ni.get<NodeParametersInterface>(); | ||
| parameters = ni.get_node_parameters_interface(); | ||
| } | ||
| { | ||
| auto time_source = ni.get<NodeTimeSourceInterface>(); | ||
| time_source = ni.get_node_time_source_interface(); |
Owner
There was a problem hiding this comment.
I think we should test the obtained interface for functionality in this test or a subsequent one, though I don't think we need to do it for every interface?
(e.g. calling the base interface's get_name)
| 0 != sizeof ...(InterfaceTs), | ||
| "must provide at least one interface as a template argument"); | ||
| static_assert( | ||
| rclcpp::detail::template_unique_v<InterfaceTs ...>, |
Owner
There was a problem hiding this comment.
I don't see the need for it now, but I'm leaving a note here for myself in the case that in the future, we want to allow users to aggregate multiple versions of the same interface type.
That is:
NodeInterfaces<NodeBaseInterface, NodeBaseInterface>(base_1, base_2);
We could potentially do it like a colliding hashmap (where we have a linked list or some other indexed sequence container stored in the tuple instead of the ptr to the interface)
rclcpp/include/rclcpp/node_interfaces/detail/node_interfaces_helpers.hpp
Outdated
Show resolved
Hide resolved
methylDragon
added a commit
that referenced
this pull request
Dec 14, 2022
Signed-off-by: methylDragon <methylDragon@gmail.com> Co-authored-by: methylDragon <methylDragon@gmail.com>
methylDragon
added a commit
that referenced
this pull request
Dec 15, 2022
Signed-off-by: methylDragon <methylDragon@gmail.com> Co-authored-by: methylDragon <methylDragon@gmail.com>
methylDragon
added a commit
that referenced
this pull request
Dec 28, 2022
Signed-off-by: methylDragon <methylDragon@gmail.com> Co-authored-by: methylDragon <methylDragon@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@methylDragon and I discussed this off-line and I drafted the changes, at least in rclcpp.
I think there might be more changes needed in places it is used. Also, changes to
LifecycleNodemight be needed or no longer needed actually, but I didn't have time to check that. All therclcpptests pass atm at least.