Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | Friends | List of all members
fkie_message_filters::Source< Outputs > Class Template Reference

Base class for data providers. More...

#include <sink.h>

Inheritance diagram for fkie_message_filters::Source< Outputs >:
Inheritance graph
[legend]

Public Types

using Output = IO< Outputs... >
 Grouped output types. More...
 

Public Member Functions

Connection connect_to_sink (Sink< Outputs... > &dst) noexcept
 Connect this source to a sink. More...
 
virtual void disconnect () noexcept override
 Disconnect from all connected sinks. More...
 
void disconnect_from_all_sinks () noexcept
 Disconnect from all connected sinks. More...
 
virtual ~Source ()
 
- Public Member Functions inherited from fkie_message_filters::FilterBase
virtual void reset () noexcept
 Reset filter state. More...
 
virtual ~FilterBase ()
 

Static Public Attributes

static constexpr std::size_t NUM_OUTPUTS = sizeof...(Outputs)
 Number of output arguments. More...
 

Protected Member Functions

void send (const Outputs &... out)
 Pass data to all connected sinks. More...
 

Private Attributes

boost::signals2::signal< void(const Outputs &...)> signal_
 

Friends

template<typename... >
class Sink
 

Detailed Description

template<typename... Outputs>
class fkie_message_filters::Source< Outputs >

Base class for data providers.

In the message filter library, all data flows from sources to sinks. The sources are providers of data, which may either be generated synthetically or gathered from other sources, such as ROS topics.

Derived classes need to call the send() method to pass actual data to the connected sinks. This class does nothing but track which sinks have been connected. The send() method takes the same number and types of arguments as specified in the template instantiation.

See also
Sink

Definition at line 33 of file sink.h.

Member Typedef Documentation

◆ Output

template<typename... Outputs>
using fkie_message_filters::Source< Outputs >::Output = IO<Outputs...>

Grouped output types.

This type can be used to define sinks with matching types.

Definition at line 54 of file source.h.

Constructor & Destructor Documentation

◆ ~Source()

template<typename... Outputs>
virtual fkie_message_filters::Source< Outputs >::~Source ( )
inlinevirtual

Definition at line 56 of file source.h.

Member Function Documentation

◆ connect_to_sink()

template<typename... Outputs>
Connection fkie_message_filters::Source< Outputs >::connect_to_sink ( Sink< Outputs... > &  dst)
noexcept

Connect this source to a sink.

Can be called multiple times to connect multiple sinks; in that case, the sinks receive data in the same order as they have been connected. This function does basically the same thing as Sink::connect_to_source(), only from the opposite point of view.

  • dst the sink that is to be connected
Returns
a connection object that can be used to monitor or sever the created connection

Definition at line 30 of file source_impl.h.

◆ disconnect()

template<typename... Outputs>
void fkie_message_filters::Source< Outputs >::disconnect ( )
overridevirtualnoexcept

◆ disconnect_from_all_sinks()

template<typename... Outputs>
void fkie_message_filters::Source< Outputs >::disconnect_from_all_sinks ( )
noexcept

Disconnect from all connected sinks.

Severs the connection to all sinks, turning the send() method into a no-op.

Definition at line 39 of file source_impl.h.

◆ send()

template<typename... Outputs>
void fkie_message_filters::Source< Outputs >::send ( const Outputs &...  out)
protected

Pass data to all connected sinks.

  • out data

Definition at line 51 of file source_impl.h.

Friends And Related Function Documentation

◆ Sink

template<typename... Outputs>
template<typename... >
friend class Sink
friend

Definition at line 46 of file source.h.

Member Data Documentation

◆ NUM_OUTPUTS

template<typename... Outputs>
constexpr std::size_t fkie_message_filters::Source< Outputs >::NUM_OUTPUTS = sizeof...(Outputs)
static

Number of output arguments.

Definition at line 49 of file source.h.

◆ signal_

template<typename... Outputs>
boost::signals2::signal<void(const Outputs&...)> fkie_message_filters::Source< Outputs >::signal_
private

Definition at line 93 of file source.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