Template Class UserSource

Inheritance Relationships

Base Type

Class Documentation

template<class ...Outputs>
class UserSource : public fkie_message_filters::Source<Outputs...>

Manually operated data source.

This data source behaves like a function object and can be called to pass data to its sinks. It is mostly useful to connect a filter pipeline to foreign data sources. Even though its technically possible to use a UserSource object as callback for a ROS subscriber, the specialized Subscriber sources have additional functionality and are easier to set up.

Public Types

using Output = IO<Outputs...>

Grouped output types.

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

Public Functions

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.

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

Manually inject data and pass it to the connected sinks.

  • out data

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

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

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.