FKIE Message Filters
Improved filters for processing ROS messages
Public Member Functions | Protected Member Functions | List of all members
fkie_message_filters::PublisherBase Class Referenceabstract

Base class for ROS publishers in a filter pipeline. More...

#include <fkie_message_filters/publisher_base.h>

Inheritance diagram for fkie_message_filters::PublisherBase:
Inheritance graph
[legend]

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...
 

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...
 

Detailed Description

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.

See also
Publisher

Member Function Documentation

◆ is_active()

virtual bool fkie_message_filters::PublisherBase::is_active ( ) const
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.

Exceptions
Does not throw any exceptions.

Implemented in fkie_message_filters::Publisher< M, Translate >, fkie_message_filters::CameraPublisher, and fkie_message_filters::ImagePublisher.

◆ link_with_subscriber()

std::tuple< boost::signals2::connection, boost::signals2::connection > fkie_message_filters::PublisherBase::link_with_subscriber ( SubscriberBase sub)
protected

Add a new subscriber that will be controlled by this publisher.

  • sub the subscriber
    Returns
    two connection objects for the signal to enable and disable the linked subscriber
    Exceptions
    Propagates exceptions raised by the implementation of the abstract class methods.

◆ topic()

virtual std::string fkie_message_filters::PublisherBase::topic ( ) const
pure virtual

Return advertised topic name.

Exceptions
Depends on the implementation.

Implemented in fkie_message_filters::Publisher< M, Translate >, fkie_message_filters::CameraPublisher, and fkie_message_filters::ImagePublisher.

◆ update_subscriber_state()

void fkie_message_filters::PublisherBase::update_subscriber_state ( )
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.

Exceptions
Propagates exceptions raised by the implementation of the abstract class methods.

The documentation for this class was generated from the following files: