Skip to content

Commit

Permalink
replace create_parameter with declare_parameter
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodall <william@osrfoundation.org>
  • Loading branch information
wjwwood committed Feb 1, 2019
1 parent 4aab3fe commit 119260a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions rclcpp/include/rclcpp/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,18 @@ class Node : public std::enable_shared_from_this<Node>
*/
RCLCPP_PUBLIC
void
create_parameter(
declare_parameter(
const std::string & name,
const rclcpp::ParameterValue & default_value = rclcpp::ParameterValue(),
bool read_only = false);

/// Declare and initialize a parameter with a type.
/**
* See the non-templated create_parameter() on this class for details.
* See the non-templated declare_parameter() on this class for details.
*/
template<typename ParameterT>
void
create_parameter(
declare_parameter(
const std::string & name,
const ParameterT & default_value,
bool read_only = false);
Expand Down
4 changes: 2 additions & 2 deletions rclcpp/include/rclcpp/node_interfaces/node_parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace node_interfaces
// Internal struct for holding useful info about parameters
struct ParameterInfo
{
/// True if a user called create_parameter()
/// True if a user called declare_parameter()
bool is_declared = false;

/// Current value of the parameter.
Expand Down Expand Up @@ -76,7 +76,7 @@ class NodeParameters : public NodeParametersInterface

RCLCPP_PUBLIC
void
create_parameter(
declare_parameter(
const std::string & name,
const rclcpp::ParameterValue & default_value,
bool read_only) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class NodeParametersInterface
RCLCPP_PUBLIC
virtual
void
create_parameter(
declare_parameter(
const std::string & name,
const rclcpp::ParameterValue & default_value = rclcpp::ParameterValue(),
bool read_only = false) = 0;
Expand Down
4 changes: 2 additions & 2 deletions rclcpp/src/rclcpp/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ Node::group_in_node(rclcpp::callback_group::CallbackGroup::SharedPtr group)
}

void
Node::create_parameter(
Node::declare_parameter(
const std::string & name,
const rclcpp::ParameterValue & default_value,
bool read_only)
{
return this->node_parameters_->create_parameter(name, default_value, read_only);
return this->node_parameters_->declare_parameter(name, default_value, read_only);
}

std::vector<rcl_interfaces::msg::SetParametersResult>
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ NodeParameters::~NodeParameters()
{}

void
NodeParameters::create_parameter(
NodeParameters::declare_parameter(
const std::string & name,
const rclcpp::ParameterValue & default_value,
bool read_only)
Expand Down
6 changes: 3 additions & 3 deletions rclcpp/test/test_node_initial_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ TEST_F(TestNodeWithInitialValues, multiple_declared_initial_values) {
auto node = rclcpp::Node::make_shared(
"node_name", "", context, arguments, initial_values, use_global_arguments, use_intra_process);

node->create_parameter("foo");
node->create_parameter("bar");
node->create_parameter("baz");
node->declare_parameter("foo");
node->declare_parameter("bar");
node->declare_parameter("baz");

auto list_params_result = node->list_parameters({}, 0);
EXPECT_TRUE(node->get_parameter("foo").get_value<bool>());
Expand Down

0 comments on commit 119260a

Please sign in to comment.