Template Class Source

Inheritance Relationships

Base Type

Derived Type

Class Documentation

template<typename ...Outputs>
class Source : public virtual fkie_message_filters::FilterBase

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

Subclassed by fkie_message_filters::Subscriber< M, Translate, A >

Public Types

using Output = IO<Outputs...>

Grouped output types.

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

Public Functions

inline virtual ~Source()
Connection 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

Does not throw any exceptions.

Returns:

a connection object that can be used to monitor or sever the created connection

virtual void disconnect() noexcept override

Disconnect from all connected sinks.

The source implementation calls disconnect_from_all_sinks().

Does not throw any exceptions.

void disconnect_from_all_sinks() noexcept

Disconnect from all connected sinks.

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

Does not throw any exceptions.

inline virtual void reset() noexcept

Reset filter state.

For stateful filters, this method resets the internal state as if the filter had just been created. Existing connections to sources and sinks are unaffected.

The default implementation does nothing.

Does not throw any exceptions.

Public Static Attributes

static std::size_t NUM_OUTPUTS = sizeof...(Outputs)

Number of output arguments.

Protected Functions

void send(helpers::argument_t<Outputs>... out)

Pass data to all connected sinks.

  • out data

Does not throw any exceptions, but will propagate uncaught exceptions from filter callbacks.