Skip to content

Commit d90b377

Browse files
author
M. Fatih Cırıt
committed
fix(tier4_autoware_utils): clang-tidy errors for published_time_publisher.hpp
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
1 parent 413514b commit d90b377

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp

+9-8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <functional>
2525
#include <map>
2626
#include <string>
27+
#include <utility>
2728

2829
namespace tier4_autoware_utils
2930
{
@@ -32,9 +33,9 @@ class PublishedTimePublisher
3233
{
3334
public:
3435
explicit PublishedTimePublisher(
35-
rclcpp::Node * node, const std::string & publisher_topic_suffix = "/debug/published_time",
36+
rclcpp::Node * node, std::string publisher_topic_suffix = "/debug/published_time",
3637
const rclcpp::QoS & qos = rclcpp::QoS(1))
37-
: node_(node), publisher_topic_suffix_(publisher_topic_suffix), qos_(qos)
38+
: node_(node), publisher_topic_suffix_(std::move(publisher_topic_suffix)), qos_(qos)
3839
{
3940
}
4041

@@ -46,16 +47,16 @@ class PublishedTimePublisher
4647
// if the publisher is not in the map, create a new publisher for published time
4748
ensure_publisher_exists(gid_key, publisher->get_topic_name());
4849

49-
const auto & pub_published_time_ = publishers_[gid_key];
50+
const auto & pub_published_time = publishers_[gid_key];
5051

5152
// Check if there are any subscribers, otherwise don't do anything
52-
if (pub_published_time_->get_subscription_count() > 0) {
53+
if (pub_published_time->get_subscription_count() > 0) {
5354
PublishedTime published_time;
5455

5556
published_time.header.stamp = stamp;
5657
published_time.published_stamp = rclcpp::Clock().now();
5758

58-
pub_published_time_->publish(published_time);
59+
pub_published_time->publish(published_time);
5960
}
6061
}
6162

@@ -67,16 +68,16 @@ class PublishedTimePublisher
6768
// if the publisher is not in the map, create a new publisher for published time
6869
ensure_publisher_exists(gid_key, publisher->get_topic_name());
6970

70-
const auto & pub_published_time_ = publishers_[gid_key];
71+
const auto & pub_published_time = publishers_[gid_key];
7172

7273
// Check if there are any subscribers, otherwise don't do anything
73-
if (pub_published_time_->get_subscription_count() > 0) {
74+
if (pub_published_time->get_subscription_count() > 0) {
7475
PublishedTime published_time;
7576

7677
published_time.header = header;
7778
published_time.published_stamp = rclcpp::Clock().now();
7879

79-
pub_published_time_->publish(published_time);
80+
pub_published_time->publish(published_time);
8081
}
8182
}
8283

0 commit comments

Comments
 (0)