Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
fkie_message_filters::SubscriberBase Class Referenceabstract

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

#include <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...
 
virtual ~SubscriberBase ()
 

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

Private Attributes

boost::signals2::connection conn1_
 
boost::signals2::connection conn2_
 

Friends

class PublisherBase
 

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

Definition at line 38 of file subscriber_base.h.

Constructor & Destructor Documentation

◆ ~SubscriberBase()

fkie_message_filters::SubscriberBase::~SubscriberBase ( )
virtual

Definition at line 41 of file publisher_subscriber_base.cpp.

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

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
See also
PublisherBase::link_with_subscriber()

Definition at line 70 of file publisher_subscriber_base.cpp.

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

Definition at line 46 of file publisher_subscriber_base.cpp.

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

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

Definition at line 58 of file publisher_subscriber_base.cpp.

◆ topic()

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

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

Definition at line 64 of file publisher_subscriber_base.cpp.

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

Definition at line 52 of file publisher_subscriber_base.cpp.

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

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

Friends And Related Function Documentation

◆ PublisherBase

friend class PublisherBase
friend

Definition at line 40 of file subscriber_base.h.

Member Data Documentation

◆ conn1_

boost::signals2::connection fkie_message_filters::SubscriberBase::conn1_
private

Definition at line 122 of file subscriber_base.h.

◆ conn2_

boost::signals2::connection fkie_message_filters::SubscriberBase::conn2_
private

Definition at line 122 of file subscriber_base.h.


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


fkie_message_filters
Author(s): Timo Röhling
autogenerated on Mon Feb 28 2022 22:21:44