Base class for ROS publishers in a filter pipeline. More...
#include <publisher_base.h>
Public Member Functions | |
virtual bool | is_active () const =0 |
Check if the publisher is active. More... | |
virtual std::string | topic () const =0 |
Return advertised topic name. More... | |
virtual | ~PublisherBase () |
Protected Member Functions | |
std::tuple< boost::signals2::connection, boost::signals2::connection > | link_with_subscriber (SubscriberBase &sub) |
Add a new subscriber that will be controlled by this publisher. More... | |
void | update_subscriber_state () |
Cause all linked subscribers to subscribe or unsubscribe to their ROS topics. More... | |
Private Attributes | |
boost::signals2::signal< void()> | disable_signal_ |
boost::signals2::signal< void()> | enable_signal_ |
Friends | |
class | SubscriberBase |
Base class for ROS publishers in a filter pipeline.
ROS subscribers and publishers can act as sources and sinks in the message filter library. This class provides some basic functionality for on-demand subscriptions.
Definition at line 39 of file publisher_base.h.
|
inlinevirtual |
Definition at line 43 of file publisher_base.h.
|
pure virtual |
Check if the publisher is active.
Returns true
if the number of subscribers is greater than zero. The result of the function is used to subscribe or unsubscribe linked subscribers on demand.
Implemented in fkie_message_filters::Publisher< M, Translate >, fkie_message_filters::CameraPublisher, and fkie_message_filters::ImagePublisher.
|
protected |
Add a new subscriber that will be controlled by this publisher.
sub
the subscriber Definition at line 27 of file publisher_subscriber_base.cpp.
|
pure virtual |
Return advertised topic name.
Implemented in fkie_message_filters::Publisher< M, Translate >, fkie_message_filters::CameraPublisher, and fkie_message_filters::ImagePublisher.
|
protected |
Cause all linked subscribers to subscribe or unsubscribe to their ROS topics.
This will check the return value of is_active() to determine if the publisher is active, and then call SubscriberBase::subscribe_impl() or SubscriberBase::unsubscribe_impl() accordingly.
Definition at line 36 of file publisher_subscriber_base.cpp.
|
friend |
Definition at line 41 of file publisher_base.h.
|
private |
Definition at line 75 of file publisher_base.h.
|
private |
Definition at line 75 of file publisher_base.h.