Topic names (#331)

* expand topic name before invoking count pub/sub

* convenience function for get_namespace()

* uncrustify

* typo

* add get_namespace() test

* add get_namespace() for lifecycle
This commit is contained in:
Karsten Knese 2017-06-01 14:01:18 -07:00 committed by GitHub
parent b90676871d
commit 454d38776c
10 changed files with 83 additions and 5 deletions

View file

@ -102,6 +102,12 @@ public:
const char *
get_name() const;
/// Get the namespace of the node.
// \return The namespace of the node.
RCLCPP_LIFECYCLE_PUBLIC
const char *
get_namespace() const;
/// Create and return a callback group.
RCLCPP_LIFECYCLE_PUBLIC
rclcpp::callback_group::CallbackGroup::SharedPtr

View file

@ -89,6 +89,12 @@ LifecycleNode::get_name() const
return node_base_->get_name();
}
const char *
LifecycleNode::get_namespace() const
{
return node_base_->get_namespace();
}
rclcpp::callback_group::CallbackGroup::SharedPtr
LifecycleNode::create_callback_group(
rclcpp::callback_group::CallbackGroupType group_type)

View file

@ -123,7 +123,8 @@ rcl_lifecycle_ret_t MoodyLifecycleNode<BadMood>::on_error(const rclcpp_lifecycle
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_EQ(State::PRIMARY_STATE_UNCONFIGURED, test_node->get_current_state().id());
}