Skip to main content

PipelineNode Class

Runtime-graph node that wraps a builder-side NodeGroup (or single Node) as a pipeline-backend node. More...

Declaration

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

Included Headers

#include <PipelineNode.h>

Base class

classNode

Base class for hybrid graph nodes. More...

Public Constructors Index

PipelineNode (const simaai::neat::NodeGroup &group, std::string label={})

Construct from a NodeGroup by copy. More...

PipelineNode (simaai::neat::NodeGroup &&group, std::string label={})

Construct from a NodeGroup by move. More...

PipelineNode (std::shared_ptr< simaai::neat::Node > node, std::string label={})

Construct from a single builder Node. More...

Public Member Functions Index

Backendbackend () const override

Always returns Backend::Pipeline. More...

std::stringkind () const override

Returns the wrapped node's kind, or "PipelineGroup" when the group has multiple nodes. More...

std::stringuser_label () const override

Returns the explicit label if set, else the wrapped single node's user_label(). More...

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

Returns the input port ("in") unless the group is source-like, in which case empty. More...

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

Always exposes a single "out" port. More...

const simaai::neat::NodeGroup &group () const

Access the wrapped builder NodeGroup. More...

boolis_source_like () const

True iff the wrapped group is source-like (has a Source role and no Push role). More...

boolrequires_input () const

True iff this node requires an upstream input port. More...

Private Member Functions Index

voidinit_ ()

Private Member Attributes Index

simaai::neat::NodeGroupgroup_
std::stringlabel_
std::stringkind_
boolis_source_like_ = false
boolrequires_input_ = true

Description

Runtime-graph node that wraps a builder-side NodeGroup (or single Node) as a pipeline-backend node.

Lets a linear, GStreamer-pipeline-shaped fragment participate in the runtime actor graph. The wrapped group's first node's InputRole is inspected to decide whether this node is source-like (no input port) or push-style (single "in" port). Always exposes a single "out" port.

See Also

simaai::neat::NodeGroup

See Also

simaai::neat::graph::Node

Definition at line 33 of file PipelineNode.h.

Public Constructors

PipelineNode()

simaai::neat::graph::nodes::PipelineNode::PipelineNode (const simaai::neat::NodeGroup & group, std::string label={})
inline explicit

Construct from a NodeGroup by copy.

Definition at line 36 of file PipelineNode.h.

36 explicit PipelineNode(const simaai::neat::NodeGroup& group, std::string label = {})
37 : group_(group), label_(std::move(label)) {
38 init_();
39 }

PipelineNode()

simaai::neat::graph::nodes::PipelineNode::PipelineNode (simaai::neat::NodeGroup && group, std::string label={})
inline explicit

Construct from a NodeGroup by move.

Definition at line 42 of file PipelineNode.h.

42 explicit PipelineNode(simaai::neat::NodeGroup&& group, std::string label = {})
43 : group_(std::move(group)), label_(std::move(label)) {
44 init_();
45 }

PipelineNode()

simaai::neat::graph::nodes::PipelineNode::PipelineNode (std::shared_ptr< simaai::neat::Node > node, std::string label={})
inline explicit

Construct from a single builder Node.

Definition at line 48 of file PipelineNode.h.

48 explicit PipelineNode(std::shared_ptr<simaai::neat::Node> node, std::string label = {})
49 : group_(std::vector<std::shared_ptr<simaai::neat::Node>>{std::move(node)}),
50 label_(std::move(label)) {
51 init_();
52 }

Public Member Functions

backend()

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

Always returns Backend::Pipeline.

Definition at line 55 of file PipelineNode.h.

55 Backend backend() const override {
57 }

group()

const simaai::neat::NodeGroup & simaai::neat::graph::nodes::PipelineNode::group ()
inline

Access the wrapped builder NodeGroup.

Definition at line 87 of file PipelineNode.h.

87 const simaai::neat::NodeGroup& group() const {
88 return group_;
89 }

input_ports()

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

Returns the input port ("in") unless the group is source-like, in which case empty.

Definition at line 75 of file PipelineNode.h.

75 std::vector<PortDesc> input_ports() const override {
76 if (!requires_input_)
77 return {};
78 return {PortDesc{.name = "in", .spec = OutputSpec{}}};
79 }

is_source_like()

bool simaai::neat::graph::nodes::PipelineNode::is_source_like ()
inline

True iff the wrapped group is source-like (has a Source role and no Push role).

Definition at line 92 of file PipelineNode.h.

92 bool is_source_like() const {
93 return is_source_like_;
94 }

kind()

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

Returns the wrapped node's kind, or "PipelineGroup" when the group has multiple nodes.

Definition at line 60 of file PipelineNode.h.

60 std::string kind() const override {
61 return kind_;
62 }

output_ports()

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

Always exposes a single "out" port.

Definition at line 82 of file PipelineNode.h.

82 std::vector<PortDesc> output_ports() const override {
83 return {PortDesc{.name = "out", .spec = OutputSpec{}}};
84 }

requires_input()

bool simaai::neat::graph::nodes::PipelineNode::requires_input ()
inline

True iff this node requires an upstream input port.

Definition at line 96 of file PipelineNode.h.

96 bool requires_input() const {
97 return requires_input_;
98 }

user_label()

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

Returns the explicit label if set, else the wrapped single node's user_label().

Definition at line 65 of file PipelineNode.h.

65 std::string user_label() const override {
66 if (!label_.empty())
67 return label_;
68 if (group_.size() == 1 && group_.nodes().front()) {
69 return group_.nodes().front()->user_label();
70 }
71 return "";
72 }

Private Member Functions

init_()

void simaai::neat::graph::nodes::PipelineNode::init_ ()
inline

Definition at line 101 of file PipelineNode.h.

101 void init_() {
102 bool has_source = false;
103 bool has_push = false;
104 const auto& nodes = group_.nodes();
105 if (nodes.size() == 1 && nodes.front()) {
106 kind_ = nodes.front()->kind();
107 } else {
108 kind_ = "PipelineGroup";
109 }
110
111 for (const auto& n : nodes) {
112 if (!n)
113 continue;
114 const InputRole role = n->input_role();
115 if (role == InputRole::Source)
116 has_source = true;
117 if (role == InputRole::Push)
118 has_push = true;
119 }
120
121 is_source_like_ = has_source && !has_push;
122 requires_input_ = !is_source_like_;
123 }

Private Member Attributes

group_

simaai::neat::NodeGroup simaai::neat::graph::nodes::PipelineNode::group_

Definition at line 125 of file PipelineNode.h.

125 simaai::neat::NodeGroup group_;

is_source_like_

bool simaai::neat::graph::nodes::PipelineNode::is_source_like_ = false

Definition at line 128 of file PipelineNode.h.

128 bool is_source_like_ = false;

kind_

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

Definition at line 127 of file PipelineNode.h.

127 std::string kind_;

label_

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

Definition at line 126 of file PipelineNode.h.

126 std::string label_;

requires_input_

bool simaai::neat::graph::nodes::PipelineNode::requires_input_ = true

Definition at line 129 of file PipelineNode.h.

129 bool requires_input_ = true;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.