Skip to content

Commit

Permalink
add get_fully_qualified_name to rclcpp_lifecycle (#2115)
Browse files Browse the repository at this point in the history
Signed-off-by: stevemacenski <stevenmacenski@gmail.com>
  • Loading branch information
SteveMacenski authored Mar 4, 2023
1 parent 399f4df commit 11778f5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rclcpp_lifecycle/include/rclcpp_lifecycle/lifecycle_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ class LifecycleNode : public node_interfaces::LifecycleNodeInterface,
const char *
get_namespace() const;

/// Get the fully-qualified name of the node.
/**
* The fully-qualified name includes the local namespace and name of the node.
* \return fully-qualified name of the node.
*/
RCLCPP_PUBLIC
const char *
get_fully_qualified_name() const;

/// Get the logger of the node.
/**
* \return The logger of the node.
Expand Down
6 changes: 6 additions & 0 deletions rclcpp_lifecycle/src/lifecycle_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ LifecycleNode::get_namespace() const
return node_base_->get_namespace();
}

const char *
LifecycleNode::get_fully_qualified_name() const
{
return node_base_->get_fully_qualified_name();
}

rclcpp::Logger
LifecycleNode::get_logger() const
{
Expand Down
1 change: 1 addition & 0 deletions rclcpp_lifecycle/test/test_lifecycle_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ TEST_F(TestDefaultStateMachine, empty_initializer) {
auto test_node = std::make_shared<EmptyLifecycleNode>("testnode");
EXPECT_STREQ("testnode", test_node->get_name());
EXPECT_STREQ("/", test_node->get_namespace());
EXPECT_STREQ("/testnode", test_node->get_fully_qualified_name());
EXPECT_EQ(State::PRIMARY_STATE_UNCONFIGURED, test_node->get_current_state().id());
}

Expand Down

0 comments on commit 11778f5

Please sign in to comment.