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

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

#include <fkie_message_filters/subscriber_base.h>

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

Public Member Functions

virtual void subscribe ()
 Subscribe to the configured ROS topic. More...
 
virtual void subscribe_on_demand (PublisherBase &pub)
 Subscribe to the configured ROS topic whenever the given publisher is active. More...
 
virtual std::string topic () const =0
 Return the subscribed topic name. More...
 
virtual void unsubscribe ()
 Unsubscribe from the configured ROS topic. More...
 

Protected Member Functions

virtual bool is_configured () const =0
 Check if the subscriber is properly configured. More...
 
void link_with_publisher (PublisherBase &pub)
 Add self to the list of subscribers which are controlled by a publisher. More...
 
virtual void subscribe_impl ()=0
 Implement how to subscribe to the configured ROS topic. More...
 
void unlink_from_publisher ()
 Remove self from the list of subscribers which are controlled by a publisher. More...
 
virtual void unsubscribe_impl ()=0
 Implement how to unsubscribe from the configured ROS topic. More...
 

Detailed Description

Base class for ROS subscribers 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
Subscriber

Member Function Documentation

◆ is_configured()

virtual bool fkie_message_filters::SubscriberBase::is_configured ( ) const
protectedpure virtual

Check if the subscriber is properly configured.

This virtual method must be overridden in derived classes.

Return values
trueif subscribe_impl() or unsubscribe_impl() may be called and have all the information they need to subscribe or unsubscribe, respectively.
falseotherwise
Exceptions
Depends on the implementation.

Implemented in fkie_message_filters::Subscriber< M, Translate >, fkie_message_filters::CameraSubscriber, and fkie_message_filters::ImageSubscriber.

◆ link_with_publisher()

void fkie_message_filters::SubscriberBase::link_with_publisher ( PublisherBase pub)
protected

Add self to the list of subscribers which are controlled by a publisher.

A subscriber can be linked with one publisher only. Any previously linked publisher is unlinked first.

  • pub publisher
Exceptions
Propagates exceptions raised by the implementation of the abstract class methods.
See also
PublisherBase::link_with_subscriber()

◆ subscribe()

void fkie_message_filters::SubscriberBase::subscribe ( )
virtual

Subscribe to the configured ROS topic.

This method does nothing if no ROS topic was configured or if the subscriber is subscribed already. Cancels the effect of subscribe_on_demand(), i.e. the subscriber will remain subscribed permanently.

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

◆ subscribe_impl()

virtual void fkie_message_filters::SubscriberBase::subscribe_impl ( )
protectedpure virtual

Implement how to subscribe to the configured ROS topic.

This virtual method must be overridden in derived classes to actually subscribe to a topic. It should do nothing if it is subscribed to a topic already.

Exceptions
Depends on the implementation.

Implemented in fkie_message_filters::Subscriber< M, Translate >, fkie_message_filters::CameraSubscriber, and fkie_message_filters::ImageSubscriber.

◆ subscribe_on_demand()

void fkie_message_filters::SubscriberBase::subscribe_on_demand ( PublisherBase pub)
virtual

Subscribe to the configured ROS topic whenever the given publisher is active.

This method does nothing if no ROS topic was configured. Otherwise, it will immediately subscribe or unsubscribe depending on the publisher's current state. If the publisher becomes active or inactive, the subscriber's state will update accordingly.

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

◆ topic()

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

Return the subscribed topic name.

Exceptions
Depends on the implementation.

Implemented in fkie_message_filters::Subscriber< M, Translate >, fkie_message_filters::CameraSubscriber, and fkie_message_filters::ImageSubscriber.

◆ unlink_from_publisher()

void fkie_message_filters::SubscriberBase::unlink_from_publisher ( )
protected

Remove self from the list of subscribers which are controlled by a publisher.

This will not affect the current subscription state. It will only prevent further updates from the previously linked publisher.

Exceptions
Does not throw any exceptions.

◆ unsubscribe()

void fkie_message_filters::SubscriberBase::unsubscribe ( )
virtual

Unsubscribe from the configured ROS topic.

You can call subscribe() afterwards to re-subscribe to the ROS topic. This method does nothing if the subscriber is not subscribed to any ROS topic. Cancels the effect of subscribe_on_demand(), i.e. the subscriber will remain unsubscribed permanently.

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

◆ unsubscribe_impl()

virtual void fkie_message_filters::SubscriberBase::unsubscribe_impl ( )
protectedpure virtual

Implement how to unsubscribe from the configured ROS topic.

This virtual method must be overridden in derived classes to actually unsubscribe from a topic. It should do nothing if it is not subscribed in the first place.

Exceptions
Depends on the implementation.

Implemented in fkie_message_filters::Subscriber< M, Translate >, fkie_message_filters::CameraSubscriber, and fkie_message_filters::ImageSubscriber.


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