Skip to main content

StageNode Class

Generic runtime-graph node that adapts a StageExecutor factory into a Node. More...

Declaration

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

Included Headers

#include <StageNode.h>

Base class

classNode

Base class for hybrid graph nodes. More...

Public Member Typedefs Index

usingStageExecutorFactory = std::function< std::unique_ptr< simaai::neat::graph::StageExecutor >()>

Factory producing a fresh StageExecutor for each instance the runtime needs. More...

usingOutputSpecFn = std::function< OutputSpec(const std::vector< OutputSpec > &, PortId)>

Resolver that returns the OutputSpec for a given output port from the per-input specs. More...

Public Constructors Index

StageNode (std::string kind, StageExecutorFactory factory, std::vector< PortDesc > inputs, std::vector< PortDesc > outputs, std::string label={}, OutputSpecFn out_fn={}, StageNodeOptions options={})

Construct a StageNode bundling kind, executor factory, port descriptors, and options. More...

Public Member Functions Index

Backendbackend () const override

Always returns Backend::Stage. More...

std::stringkind () const override

Returns the stage's kind label. More...

std::stringuser_label () const override

Returns the user-supplied label (or empty). More...

std::vector< PortDesc >input_ports () const override

Returns the configured input ports. More...

std::vector< PortDesc >output_ports () const override

Returns the configured output ports. More...

OutputSpecoutput_spec (const std::vector< OutputSpec > &inputs, PortId out_port) const override

Resolves an output port's spec via the user-supplied resolver, falling back to the single output's static spec. More...

const StageExecutorFactory &factory () const

Access the executor factory. More...

const StageNodeOptions &options () const

Access the stage options. More...

Private Member Attributes Index

std::stringkind_
std::stringlabel_
std::vector< PortDesc >inputs_
std::vector< PortDesc >outputs_
StageExecutorFactoryfactory_
OutputSpecFnoutput_spec_fn_
StageNodeOptionsoptions_

Description

Generic runtime-graph node that adapts a StageExecutor factory into a Node.

The most generic stage adapter — given a StageExecutorFactory, an input/output port description, and an Options bundle, exposes the stage as a runtime graph Node. Most concrete stages (FanOut, JoinBundle, Map, ...) have helpers that build a StageNode around their executor.

See Also

StageExecutor

See Also

StageNodeOptions

Definition at line 61 of file StageNode.h.

Public Member Typedefs

OutputSpecFn

using simaai::neat::graph::nodes::StageNode::OutputSpecFn = std::function<OutputSpec(const std::vector<OutputSpec>&, PortId)>

Resolver that returns the OutputSpec for a given output port from the per-input specs.

Definition at line 66 of file StageNode.h.

66 using OutputSpecFn = std::function<OutputSpec(const std::vector<OutputSpec>&, PortId)>;

StageExecutorFactory

using simaai::neat::graph::nodes::StageNode::StageExecutorFactory = std::function<std::unique_ptr<simaai::neat::graph::StageExecutor>()>

Factory producing a fresh StageExecutor for each instance the runtime needs.

Definition at line 64 of file StageNode.h.

64 using StageExecutorFactory = std::function<std::unique_ptr<simaai::neat::graph::StageExecutor>()>;

Public Constructors

StageNode()

simaai::neat::graph::nodes::StageNode::StageNode (std::string kind, StageExecutorFactory factory, std::vector< PortDesc > inputs, std::vector< PortDesc > outputs, std::string label={}, OutputSpecFn out_fn={}, StageNodeOptions options={})
inline

Construct a StageNode bundling kind, executor factory, port descriptors, and options.

Definition at line 69 of file StageNode.h.

69 StageNode(std::string kind, StageExecutorFactory factory, std::vector<PortDesc> inputs,
70 std::vector<PortDesc> outputs, std::string label = {}, OutputSpecFn out_fn = {},
71 StageNodeOptions options = {})
72 : kind_(std::move(kind)), label_(std::move(label)), inputs_(std::move(inputs)),
73 outputs_(std::move(outputs)), factory_(std::move(factory)),
74 output_spec_fn_(std::move(out_fn)), options_(std::move(options)) {}

Public Member Functions

backend()

Backend simaai::neat::graph::nodes::StageNode::backend ()
inline virtual

Always returns Backend::Stage.

Definition at line 77 of file StageNode.h.

77 Backend backend() const override {
78 return Backend::Stage;
79 }

factory()

const StageExecutorFactory & simaai::neat::graph::nodes::StageNode::factory ()
inline

Access the executor factory.

Definition at line 112 of file StageNode.h.

113 return factory_;
114 }

input_ports()

std::vector< PortDesc > simaai::neat::graph::nodes::StageNode::input_ports ()
inline virtual

Returns the configured input ports.

Definition at line 92 of file StageNode.h.

92 std::vector<PortDesc> input_ports() const override {
93 return inputs_;
94 }

kind()

std::string simaai::neat::graph::nodes::StageNode::kind ()
inline virtual

Returns the stage's kind label.

Definition at line 82 of file StageNode.h.

82 std::string kind() const override {
83 return kind_;
84 }

options()

const StageNodeOptions & simaai::neat::graph::nodes::StageNode::options ()
inline

Access the stage options.

Definition at line 116 of file StageNode.h.

116 const StageNodeOptions& options() const {
117 return options_;
118 }

output_ports()

std::vector< PortDesc > simaai::neat::graph::nodes::StageNode::output_ports ()
inline virtual

Returns the configured output ports.

Definition at line 97 of file StageNode.h.

97 std::vector<PortDesc> output_ports() const override {
98 return outputs_;
99 }

output_spec()

OutputSpec simaai::neat::graph::nodes::StageNode::output_spec (const std::vector< OutputSpec > & inputs, PortId out_port)
inline virtual

Resolves an output port's spec via the user-supplied resolver, falling back to the single output's static spec.

Definition at line 103 of file StageNode.h.

103 OutputSpec output_spec(const std::vector<OutputSpec>& inputs, PortId out_port) const override {
104 if (output_spec_fn_)
105 return output_spec_fn_(inputs, out_port);
106 if (outputs_.size() == 1)
107 return outputs_.front().spec;
108 return OutputSpec{};
109 }

user_label()

std::string simaai::neat::graph::nodes::StageNode::user_label ()
inline virtual

Returns the user-supplied label (or empty).

Definition at line 87 of file StageNode.h.

87 std::string user_label() const override {
88 return label_;
89 }

Private Member Attributes

factory_

StageExecutorFactory simaai::neat::graph::nodes::StageNode::factory_

Definition at line 125 of file StageNode.h.

125 StageExecutorFactory factory_;

inputs_

std::vector<PortDesc> simaai::neat::graph::nodes::StageNode::inputs_

Definition at line 123 of file StageNode.h.

123 std::vector<PortDesc> inputs_;

kind_

std::string simaai::neat::graph::nodes::StageNode::kind_

Definition at line 121 of file StageNode.h.

121 std::string kind_;

label_

std::string simaai::neat::graph::nodes::StageNode::label_

Definition at line 122 of file StageNode.h.

122 std::string label_;

options_

StageNodeOptions simaai::neat::graph::nodes::StageNode::options_

Definition at line 127 of file StageNode.h.

127 StageNodeOptions options_;

output_spec_fn_

OutputSpecFn simaai::neat::graph::nodes::StageNode::output_spec_fn_

Definition at line 126 of file StageNode.h.

126 OutputSpecFn output_spec_fn_;

outputs_

std::vector<PortDesc> simaai::neat::graph::nodes::StageNode::outputs_

Definition at line 124 of file StageNode.h.

124 std::vector<PortDesc> outputs_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.