Skip to content

Commit

Permalink
Use BOOST_FOREACH and take publisher by const ref.
Browse files Browse the repository at this point in the history
  • Loading branch information
efernandez committed Apr 22, 2018
1 parent 473a1b9 commit f8b1db2
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <ros/ros.h>
#include <nodelet/nodelet.h>
#include <image_transport/image_transport.h>
#include <boost/foreach.hpp>
#include <boost/thread.hpp>
#include <string>
#include <vector>
Expand Down Expand Up @@ -145,9 +146,8 @@ class NodeletLazy: public nodelet::Nodelet
if (lazy_)
{
boost::mutex::scoped_lock lock(connection_mutex_);
for (size_t i = 0; i < publishers_.size(); i++)
BOOST_FOREACH (const ros::Publisher& pub, publishers_)
{
ros::Publisher pub = publishers_[i];
if (pub.getNumSubscribers() > 0)
{
if (connection_status_ != SUBSCRIBED)
Expand All @@ -166,9 +166,8 @@ class NodeletLazy: public nodelet::Nodelet
return;
}
}
for (size_t i = 0; i < image_transport_publishers_.size(); i++)
BOOST_FOREACH (const image_transport::Publisher& pub, image_transport_publishers_)
{
image_transport::Publisher pub = image_transport_publishers_[i];
if (pub.getNumSubscribers() > 0)
{
if (connection_status_ != SUBSCRIBED)
Expand Down

0 comments on commit f8b1db2

Please sign in to comment.