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

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

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

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

Definition at line 57 of file publisher_base.h.

Constructor & Destructor Documentation

◆ ~PublisherBase()

virtual fkie_message_filters::PublisherBase::~PublisherBase ( )
inlinevirtual

Definition at line 61 of file publisher_base.h.

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.

\nothrow

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
    \implthrow

Definition at line 45 of file publisher_subscriber_base.cpp.

◆ topic()

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

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

\implthrow

Definition at line 54 of file publisher_subscriber_base.cpp.

Friends And Related Function Documentation

◆ SubscriberBase

friend class SubscriberBase
friend

Definition at line 59 of file publisher_base.h.

Member Data Documentation

◆ disable_signal_

boost::signals2::signal<void()> fkie_message_filters::PublisherBase::disable_signal_
private

Definition at line 93 of file publisher_base.h.

◆ enable_signal_

boost::signals2::signal<void()> fkie_message_filters::PublisherBase::enable_signal_
private

Definition at line 93 of file publisher_base.h.


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


fkie_message_filters
Author(s): Timo Röhling
autogenerated on Wed Mar 2 2022 00:18:57