ark::pipeline::CallbackStage

Defined in header “ark/pipeline/testing/callback_stage.hh”.


This is a stage that allows you to wrap a callback, and takes care of publishing/subscribing for you automatically.

It is considered a convenience routine for testing, as there are many ways to abuse this in production code (in particular, not being able to capture variables in a meaningful way makes this not very useful outside of testing contexts).

Typedefs

  • using CallbackFunction = std::conditional_t< std::is_same_v< PublisherType, void >, std::function< void(const SubscriberType &type)>, std::function< std::optional< PublisherType >(const SubscriberType &type)> >

Methods

  • CallbackStage(std::string subscriber_channel, std::string publisher_channel, CallbackFunction callback, const std::string & stage_name)
    Constructor. Invokes the given callback each time a message arrives from the supplied subscriber.

  • void initialize(pipeline::StageInterface & interface)
    Called from the executor when we are initialized.