35 #ifndef IMAGE_TRANSPORT_SIMPLE_PUBLISHER_PLUGIN_H 36 #define IMAGE_TRANSPORT_SIMPLE_PUBLISHER_PLUGIN_H 39 #include <boost/scoped_ptr.hpp> 78 virtual void publish(
const sensor_msgs::Image& message)
const 81 ROS_ASSERT_MSG(
false,
"Call to publish() on an invalid image_transport::SimplePublisherPlugin");
101 simple_impl_.reset(
new SimplePublisherPluginImpl(param_nh));
105 tracked_object, latch);
119 virtual void publish(
const sensor_msgs::Image& message,
const PublishFn& publish_fn)
const = 0;
205 internal_cb(ros_ssp);
210 typedef void (
SimplePublisherPlugin::*PublishMemFn)(
const sensor_msgs::Image&,
const PublishFn&)
const;
228 template <
class PubT>
232 typedef void (PubT::*InternalPublishMemFn)(
const M&)
const;
233 InternalPublishMemFn internal_pub_mem_fn = &PubT::publish;
234 return boost::bind(internal_pub_mem_fn, &pub, _1);
virtual uint32_t getNumSubscribers() const
Returns the number of subscribers that are currently connected to this PublisherPlugin.
boost::function< void(const SingleSubscriberPublisher &)> SubscriberStatusCallback
boost::function< void(const SingleSubscriberPublisher &)> SubscriberStatusCallback
void(SimplePublisherPlugin::* SubscriberStatusMemFn)(const ros::SingleSubscriberPublisher &pub)
SimplePublisherPluginImpl(const ros::NodeHandle &nh)
virtual std::string getTopicToAdvertise(const std::string &base_topic) const
Return the communication topic name for a given base topic.
boost::function< void(const M &)> PublishFn
Generic function for publishing the internal message type.
virtual std::string getTransportName() const =0
Get a string identifier for the transport provided by this plugin.
const ros::Publisher & getPublisher() const
Returns the internal ros::Publisher.
virtual void publish(const sensor_msgs::Image &message) const
Publish an image using the transport associated with this PublisherPlugin.
const ros::NodeHandle param_nh_
void subscriberCB(const ros::SingleSubscriberPublisher &ros_ssp, const SubscriberStatusCallback &user_cb, const ros::SubscriberStatusCallback &internal_cb)
#define ROS_ASSERT_MSG(cond,...)
virtual std::string getTopic() const
Returns the communication topic that this PublisherPlugin will publish on.
virtual void advertiseImpl(ros::NodeHandle &nh, const std::string &base_topic, uint32_t queue_size, const SubscriberStatusCallback &user_connect_cb, const SubscriberStatusCallback &user_disconnect_cb, const ros::VoidPtr &tracked_object, bool latch)
Advertise a topic. Must be implemented by the subclass.
boost::function< void(const sensor_msgs::Image &)> ImagePublishFn
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
boost::scoped_ptr< SimplePublisherPluginImpl > simple_impl_
ros::SubscriberStatusCallback bindCB(const SubscriberStatusCallback &user_cb, SubscriberStatusMemFn internal_cb_fn)
Base class to simplify implementing most plugins to Publisher.
Allows publication of an image to a single subscriber. Only available inside subscriber connection ca...
virtual void shutdown()
Shutdown any advertisements associated with this PublisherPlugin.
virtual ~SimplePublisherPlugin()
virtual void connectCallback(const ros::SingleSubscriberPublisher &pub)
Function called when a subscriber connects to the internal publisher.
PublishFn bindInternalPublisher(const PubT &pub) const
Base class for plugins to Publisher.
std::string getSubscriberName() const
virtual void disconnectCallback(const ros::SingleSubscriberPublisher &pub)
Function called when a subscriber disconnects from the internal publisher.
const ros::NodeHandle & nh() const
Returns the ros::NodeHandle to be used for parameter lookup.