Skip to content

Commit 3147c81

Browse files
clalancetteAlberto Soragna
authored andcommitted
Cleanup the lifecycle implementation (ros2#2027)
* Split lifecycle_node_interface_impl into header and implementation. There is no reason it should all be in the header file. No functional change. * Mark LifecycleNodeInterfaceImpl as final. * Update documentation about return codes. * Mark a bunch of LifecycleNodeInterfaceImpl methods as const. * Make most of LifecycleNodeInterfaceImpl private. * Mark some LifecycleNode methods as const. * Disable copies on LifecycleNodeInterfaceImpl. Signed-off-by: Chris Lalancette <[email protected]>
1 parent b9f48f7 commit 3147c81

File tree

6 files changed

+626
-475
lines changed

6 files changed

+626
-475
lines changed

rclcpp_lifecycle/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ find_package(lifecycle_msgs REQUIRED)
1919
### CPP High level library
2020
add_library(rclcpp_lifecycle
2121
src/lifecycle_node.cpp
22+
src/lifecycle_node_interface_impl.cpp
2223
src/managed_entity.cpp
2324
src/node_interfaces/lifecycle_node_interface.cpp
2425
src/state.cpp

rclcpp_lifecycle/include/rclcpp_lifecycle/lifecycle_node.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,23 +752,23 @@ class LifecycleNode : public node_interfaces::LifecycleNodeInterface,
752752
*/
753753
RCLCPP_LIFECYCLE_PUBLIC
754754
std::vector<State>
755-
get_available_states();
755+
get_available_states() const;
756756

757757
/// Return a list with the current available transitions.
758758
/**
759759
* \return list with the current available transitions.
760760
*/
761761
RCLCPP_LIFECYCLE_PUBLIC
762762
std::vector<Transition>
763-
get_available_transitions();
763+
get_available_transitions() const;
764764

765765
/// Return a list with all the transitions.
766766
/**
767767
* \return list with all the transitions in the transition graph.
768768
*/
769769
RCLCPP_LIFECYCLE_PUBLIC
770770
std::vector<Transition>
771-
get_transition_graph();
771+
get_transition_graph() const;
772772

773773
/// Trigger the specified transition.
774774
/*

rclcpp_lifecycle/include/rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,39 +63,39 @@ class LifecycleNodeInterface
6363

6464
/// Callback function for cleanup transition
6565
/*
66-
* \return true by default
66+
* \return SUCCESS by default
6767
*/
6868
RCLCPP_LIFECYCLE_PUBLIC
6969
virtual CallbackReturn
7070
on_cleanup(const State & previous_state);
7171

7272
/// Callback function for shutdown transition
7373
/*
74-
* \return true by default
74+
* \return SUCCESS by default
7575
*/
7676
RCLCPP_LIFECYCLE_PUBLIC
7777
virtual CallbackReturn
7878
on_shutdown(const State & previous_state);
7979

8080
/// Callback function for activate transition
8181
/*
82-
* \return true by default
82+
* \return SUCCESS by default
8383
*/
8484
RCLCPP_LIFECYCLE_PUBLIC
8585
virtual CallbackReturn
8686
on_activate(const State & previous_state);
8787

8888
/// Callback function for deactivate transition
8989
/*
90-
* \return true by default
90+
* \return SUCCESS by default
9191
*/
9292
RCLCPP_LIFECYCLE_PUBLIC
9393
virtual CallbackReturn
9494
on_deactivate(const State & previous_state);
9595

9696
/// Callback function for errorneous transition
9797
/*
98-
* \return false by default
98+
* \return SUCCESS by default
9999
*/
100100
RCLCPP_LIFECYCLE_PUBLIC
101101
virtual CallbackReturn

rclcpp_lifecycle/src/lifecycle_node.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,19 +509,19 @@ LifecycleNode::get_current_state()
509509
}
510510

511511
std::vector<State>
512-
LifecycleNode::get_available_states()
512+
LifecycleNode::get_available_states() const
513513
{
514514
return impl_->get_available_states();
515515
}
516516

517517
std::vector<Transition>
518-
LifecycleNode::get_available_transitions()
518+
LifecycleNode::get_available_transitions() const
519519
{
520520
return impl_->get_available_transitions();
521521
}
522522

523523
std::vector<Transition>
524-
LifecycleNode::get_transition_graph()
524+
LifecycleNode::get_transition_graph() const
525525
{
526526
return impl_->get_transition_graph();
527527
}

0 commit comments

Comments
 (0)