Skip to main content

LambdaStage Class

Generic stage executor whose behavior is supplied by user-provided callbacks. More...

Declaration

class simaai::neat::graph::nodes::LambdaStage { ... }

Included Headers

#include <LambdaStage.h>

Base class

classStageExecutor

Actor-style executor base class — implement to add a new runtime-graph stage. More...

Public Constructors Index

LambdaStage (LambdaOnInput on_input, LambdaOnTick on_tick={})

Construct a LambdaStage. on_input is required; on_tick is optional. More...

Public Member Functions Index

voidset_ports (const StagePorts &ports) override

Capture the runtime ports for forwarding to user callbacks. More...

voidon_input (StageMsg &&msg, std::vector< StageOutMsg > &out) override

Forward the incoming message to the user-supplied input handler. More...

voidon_tick (std::int64_t now_ns, std::vector< StageOutMsg > &out) override

Forward the tick to the user-supplied tick handler if one was provided. More...

Private Member Attributes Index

StagePortsports_
LambdaOnInputon_input_
LambdaOnTickon_tick_

Description

Generic stage executor whose behavior is supplied by user-provided callbacks.

Wraps a LambdaOnInput (required) and an optional LambdaOnTick so callers can express stage logic inline without subclassing StageExecutor. The bound StagePorts is forwarded to each callback so it can resolve port ids by name.

See Also

LambdaStageNode

See Also

StageExecutor

Definition at line 38 of file LambdaStage.h.

Public Constructors

LambdaStage()

simaai::neat::graph::nodes::LambdaStage::LambdaStage (LambdaOnInput on_input, LambdaOnTick on_tick={})
inline

Construct a LambdaStage. on_input is required; on_tick is optional.

Definition at line 41 of file LambdaStage.h.

42 : on_input_(std::move(on_input)), on_tick_(std::move(on_tick)) {
43 if (!on_input_) {
44 throw std::invalid_argument("LambdaStage: on_input function is required");
45 }
46 }

Public Member Functions

on_input()

void simaai::neat::graph::nodes::LambdaStage::on_input (StageMsg && msg, std::vector< StageOutMsg > & out)
inline virtual

Forward the incoming message to the user-supplied input handler.

Definition at line 54 of file LambdaStage.h.

54 void on_input(StageMsg&& msg, std::vector<StageOutMsg>& out) override {
55 on_input_(std::move(msg), out, ports_);
56 }

on_tick()

void simaai::neat::graph::nodes::LambdaStage::on_tick (std::int64_t now_ns, std::vector< StageOutMsg > & out)
inline virtual

Forward the tick to the user-supplied tick handler if one was provided.

Definition at line 59 of file LambdaStage.h.

59 void on_tick(std::int64_t now_ns, std::vector<StageOutMsg>& out) override {
60 if (on_tick_)
61 on_tick_(now_ns, out, ports_);
62 }

set_ports()

void simaai::neat::graph::nodes::LambdaStage::set_ports (const StagePorts & ports)
inline virtual

Capture the runtime ports for forwarding to user callbacks.

Definition at line 49 of file LambdaStage.h.

49 void set_ports(const StagePorts& ports) override {
50 ports_ = ports;
51 }

Private Member Attributes

on_input_

LambdaOnInput simaai::neat::graph::nodes::LambdaStage::on_input_

Definition at line 66 of file LambdaStage.h.

66 LambdaOnInput on_input_;

on_tick_

LambdaOnTick simaai::neat::graph::nodes::LambdaStage::on_tick_

Definition at line 67 of file LambdaStage.h.

67 LambdaOnTick on_tick_;

ports_

StagePorts simaai::neat::graph::nodes::LambdaStage::ports_

Definition at line 65 of file LambdaStage.h.

65 StagePorts ports_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.