A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
a11::flow::graph::GraphBuilder Class Reference

Appends to a [FlowGraph] while the resolver walks a flow. More...

#include <cpp/a11/flow/graph.h>

Public Member Functions

 GraphBuilder (FlowGraph &flow)
 
FlowGraph & flow ()
 
BodyId AddBody (std::string label, BodyId parent=kNone, StepId owner_step=kNone)
 
bool Carries (RefId ref) const
 Whether the ref already in the graph carries at most one value.
 
RefId AddRef (Ref ref)
 Append a ref, working out what it carries.
 
StepId AddStep (Step step)
 Append a step, and record it in the body it belongs to.
 
ExprId AddExpr (Expr expr)
 
Ref & ref (RefId id)
 
Step & step (StepId id)
 
Expr & expr (ExprId id)
 

Static Public Member Functions

static bool StageMakesOne (const Stage &stage)
 Whether a stage yields exactly one value however many it was given.
 
static bool StagePreservesCount (const Stage &stage)
 Whether a stage yields one value per value it was given.
 

Detailed Description

Appends to a [FlowGraph] while the resolver walks a flow.

Keeps step allocation and insertion into the owning body in one operation. The resolver omits this builder on editor-only paths that do not need an executable graph.

Constructor & Destructor Documentation

◆ GraphBuilder()

a11::flow::graph::GraphBuilder::GraphBuilder ( FlowGraph &  flow)
inlineexplicit

Member Function Documentation

◆ AddBody()

BodyId a11::flow::graph::GraphBuilder::AddBody ( std::string  label,
BodyId  parent = kNone,
StepId  owner_step = kNone 
)
inline

◆ AddExpr()

ExprId a11::flow::graph::GraphBuilder::AddExpr ( Expr  expr)
inline

◆ AddRef()

RefId a11::flow::graph::GraphBuilder::AddRef ( Ref  ref)
inline

Append a ref, working out what it carries.

Unarity is settled here rather than at each of the dozen places a ref is made, because it is a property of the shape of the ref for every kind but the two that name a declared port – and a kind added to the language then gets an answer by default instead of silently keeping whatever the struct's initialiser said.

◆ AddStep()

StepId a11::flow::graph::GraphBuilder::AddStep ( Step  step)
inline

Append a step, and record it in the body it belongs to.

◆ Carries()

bool a11::flow::graph::GraphBuilder::Carries ( RefId  ref) const
inline

Whether the ref already in the graph carries at most one value.

◆ expr()

Expr & a11::flow::graph::GraphBuilder::expr ( ExprId  id)
inline

◆ flow()

FlowGraph & a11::flow::graph::GraphBuilder::flow ( )
inline

◆ ref()

Ref & a11::flow::graph::GraphBuilder::ref ( RefId  id)
inline

◆ StageMakesOne()

static bool a11::flow::graph::GraphBuilder::StageMakesOne ( const Stage &  stage)
inlinestatic

Whether a stage yields exactly one value however many it was given.

The reducing three, and first 1, which is how a pipeline says "the value" out loud. Read from [vocabulary::ReducingStages] rather than listed again, so a stage that joins that set is counted here without being taught.

◆ StagePreservesCount()

static bool a11::flow::graph::GraphBuilder::StagePreservesCount ( const Stage &  stage)
inlinestatic

Whether a stage yields one value per value it was given.

Then one in gives one out. map, at, truncate, text, json, packb and strformat reshape each value; log and logf reshape nothing and pass each value straight on; where, mime and distinct may drop one, which is still at most one out per one in; scan publishes the state it reached at each value, so one in gives exactly one out; batch and group gather several into a list, which is fewer, as is window – its first n - 1 values produce nothing – and chunk and then make more. Anything the language gains is assumed not to preserve the count until it says so, which is the safe direction.

◆ step()

Step & a11::flow::graph::GraphBuilder::step ( StepId  id)
inline

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