Skip to content

Commit

Permalink
Update indent.
Browse files Browse the repository at this point in the history
Signed-off-by: Lei Liu <[email protected]>
  • Loading branch information
llapx committed Jul 5, 2021
1 parent a190752 commit c2e5e13
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions demo_nodes_cpp/src/topics/listener_loaned_message.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014 Open Source Robotics Foundation, Inc.
// Copyright 2021 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,34 +20,34 @@

namespace demo_nodes_cpp
{
// Create a Listener class that subclasses the generic rclcpp::Node base class.
// The main function below will instantiate the class as a ROS node.
class LoanedMessageListener : public rclcpp::Node
// Create a Listener class that subclasses the generic rclcpp::Node base class.
// The main function below will instantiate the class as a ROS node.
class LoanedMessageListener : public rclcpp::Node
{
public:
DEMO_NODES_CPP_PUBLIC
explicit LoanedMessageListener(const rclcpp::NodeOptions & options)
: Node("listener_loaned_message", options)
{
public:
DEMO_NODES_CPP_PUBLIC
explicit LoanedMessageListener(const rclcpp::NodeOptions &options)
: Node("listener_loaned_message", options)
{
// Create a callback function for when messages are received.
// Variations of this function also exist using, for example UniquePtr for zero-copy transport.
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
auto callback =
[this](const std_msgs::msg::Float64::SharedPtr msg) -> void
// Create a callback function for when messages are received.
// Variations of this function also exist using, for example UniquePtr for zero-copy transport.
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
auto callback =
[this](const std_msgs::msg::Float64::SharedPtr msg) -> void
{
RCLCPP_INFO(this->get_logger(), "I heard: [%f]", msg->data);
};
// Create a subscription to the topic which can be matched with one or more compatible ROS
// publishers.
// Note that not all publishers on the same topic with the same type will be compatible:
// they must have compatible Quality of Service policies.
sub_ = create_subscription<std_msgs::msg::Float64>("chatter_pod", 10, callback);
}
// Create a subscription to the topic which can be matched with one or more compatible ROS
// publishers.
// Note that not all publishers on the same topic with the same type will be compatible:
// they must have compatible Quality of Service policies.
sub_ = create_subscription<std_msgs::msg::Float64>("chatter_pod", 10, callback);
}

private:
rclcpp::Subscription<std_msgs::msg::Float64>::SharedPtr sub_;
};
private:
rclcpp::Subscription<std_msgs::msg::Float64>::SharedPtr sub_;
};

} // namespace demo_nodes_cpp
} // namespace demo_nodes_cpp

RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::LoanedMessageListener)

0 comments on commit c2e5e13

Please sign in to comment.