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

A value only the host knows what to do with. More...

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

Public Member Functions

virtual ~HostObject ()=default
 
virtual std::string Tag () const =0
 The tag the host knows this type by, for a message.
 
virtual std::string Text () const =0
 What as_text gives: what the value is on the wire, not its repr.
 
virtual bool Truthy () const =0
 Whether the value counts as true.
 
virtual std::optional< size_t > Size () const =0
 How many things it holds, where that means anything.
 
virtual Value Field (std::string_view name) const =0
 value.name, or a null value when there is no such field.
 
virtual Value Element (const Value &key) const =0
 value[key].
 
virtual bool Equals (const HostObject &other) const =0
 Whether this is the same value as other, by the host's own equality.
 

Detailed Description

A value only the host knows what to do with.

The language's own values are JSON-ish, plus durations, instants, bytes and chunks – everything a flow can write. But coerce validates into types a serialisation registry has been told about, and which types exist is the host's decision: a flow cannot import anything, so a11.sdk.Interaction is a pydantic model in the process running the flow and nothing the language can construct. So a coerced value is carried as one of these, and the language only ever asks it the questions an expression can ask: render it, index it, compare it, is it there.

A host object is immutable and shared: an item fans out to every reader of a stream, and copying a model per reader would be paid for in the host's allocator for nothing.

Constructor & Destructor Documentation

◆ ~HostObject()

virtual a11::flow::HostObject::~HostObject ( )
virtualdefault

Member Function Documentation

◆ Element()

virtual Value a11::flow::HostObject::Element ( const Value &  key) const
pure virtual

value[key].

◆ Equals()

virtual bool a11::flow::HostObject::Equals ( const HostObject &  other) const
pure virtual

Whether this is the same value as other, by the host's own equality.

◆ Field()

virtual Value a11::flow::HostObject::Field ( std::string_view  name) const
pure virtual

value.name, or a null value when there is no such field.

Reading a field a producer did not send answers nothing rather than failing, which is what lets a flow say if not thing.field.

◆ Size()

virtual std::optional< size_t > a11::flow::HostObject::Size ( ) const
pure virtual

How many things it holds, where that means anything.

◆ Tag()

virtual std::string a11::flow::HostObject::Tag ( ) const
pure virtual

The tag the host knows this type by, for a message.

◆ Text()

virtual std::string a11::flow::HostObject::Text ( ) const
pure virtual

What as_text gives: what the value is on the wire, not its repr.

◆ Truthy()

virtual bool a11::flow::HostObject::Truthy ( ) const
pure virtual

Whether the value counts as true.


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