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

One stream in the plan. More...

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

Public Attributes

RefKind kind = RefKind::kExpr
 
std::string label
 How a reader would say it: search.hits | truncate 200.
 
BodyId owner = kNone
 The body this belongs to, which is where it is materialised.
 
bool writable = false
 Whether this flow could ever write it, which is what makes it a destination rather than something finished by being read to its end.
 
bool unary = false
 Whether this stream provably carries at most one value.
 
long long skip = 0
 How many of this stream's first values skip n has spoken for.
 
std::string name
 kFlowPort, kCallPort, kNode: the port or node name.
 
syntax::PortDirection direction = syntax::PortDirection::kInput
 kFlowPort, kCallPort: which side it is on.
 
StepId call = kNone
 kCallPort: the call it belongs to.
 
ExprId id_expr = kNone
 kNode: the id expression it attaches to, and the map it lands in.
 
std::string node_map
 
RefId subject = kNone
 kNodeId: the node. kStatus: the node or port it is the outcome of.
 
StepId subject_step = kNone
 kStatus: the call or barrier it is the outcome of.
 
std::string header
 kHeader: the header name, and the default when it was not sent.
 
syntax::Constant fallback
 
bool has_fallback = false
 
ExprId expr = kNone
 kExpr: the expression evaluated once.
 
RefId source = kNone
 kDerived: what it reads, and the stage applied to it.
 
Stage stage
 
std::string role
 kBound: which of a loop's streams this is – item, index, carry.
 
StepId bound_by = kNone
 
std::vector< RefId > sources
 kZip: the streams read in step, in the order they were written, which is the order their values appear in each tuple.
 

Detailed Description

One stream in the plan.

A tagged struct rather than a class hierarchy: which fields mean anything depends on kind, and the runtime switches on it anyway. What every kind shares is the two questions the analysis asks – what it reads as a stream, and what it reads for one value – and those are answered by [Graph::Upstreams] and [Graph::ValueRefs] rather than by each kind separately.

Member Data Documentation

◆ bound_by

StepId a11::flow::graph::Ref::bound_by = kNone

◆ call

StepId a11::flow::graph::Ref::call = kNone

kCallPort: the call it belongs to.

◆ direction

syntax::PortDirection a11::flow::graph::Ref::direction = syntax::PortDirection::kInput

kFlowPort, kCallPort: which side it is on.

◆ expr

ExprId a11::flow::graph::Ref::expr = kNone

kExpr: the expression evaluated once.

◆ fallback

syntax::Constant a11::flow::graph::Ref::fallback

◆ has_fallback

bool a11::flow::graph::Ref::has_fallback = false

◆ header

std::string a11::flow::graph::Ref::header

kHeader: the header name, and the default when it was not sent.

◆ id_expr

ExprId a11::flow::graph::Ref::id_expr = kNone

kNode: the id expression it attaches to, and the map it lands in.

◆ kind

RefKind a11::flow::graph::Ref::kind = RefKind::kExpr

◆ label

std::string a11::flow::graph::Ref::label

How a reader would say it: search.hits | truncate 200.

◆ name

std::string a11::flow::graph::Ref::name

kFlowPort, kCallPort, kNode: the port or node name.

◆ node_map

std::string a11::flow::graph::Ref::node_map

◆ owner

BodyId a11::flow::graph::Ref::owner = kNone

The body this belongs to, which is where it is materialised.

◆ role

std::string a11::flow::graph::Ref::role

kBound: which of a loop's streams this is – item, index, carry.

◆ skip

long long a11::flow::graph::Ref::skip = 0

How many of this stream's first values skip n has spoken for.

Applied where the stream is produced, upstream of the fan-out, so it is the same values every reader does not see. Several skip n statements naming one node add up: the ref is one object however many times the flow mentions it.

◆ source

RefId a11::flow::graph::Ref::source = kNone

kDerived: what it reads, and the stage applied to it.

◆ sources

std::vector<RefId> a11::flow::graph::Ref::sources

kZip: the streams read in step, in the order they were written, which is the order their values appear in each tuple.

kMerge: the streams read at once, where the order they were written in says nothing about the order their values arrive in.

◆ stage

Stage a11::flow::graph::Ref::stage

◆ subject

RefId a11::flow::graph::Ref::subject = kNone

kNodeId: the node. kStatus: the node or port it is the outcome of.

◆ subject_step

StepId a11::flow::graph::Ref::subject_step = kNone

kStatus: the call or barrier it is the outcome of.

◆ unary

bool a11::flow::graph::Ref::unary = false

Whether this stream provably carries at most one value.

A claim, so the default is the absence of one: something that forgets to say is treated as a stream, which costs a check rather than being wrong. A declared port says so (in q: string against in q: string stream), an action's schema says so for its own ports, and everything built out of those is derived from them by [Builder::AddRef] – a reducing stage makes one value out of many, a per-value stage keeps the count it was given, and a node the flow writes from anywhere is never one.

What it is for: reading a stream where a value is expected. A unary stream can be consumed – take the value, and a second one is an error the language can name – while a stream of many has to say which value it means.

◆ writable

bool a11::flow::graph::Ref::writable = false

Whether this flow could ever write it, which is what makes it a destination rather than something finished by being read to its end.


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