17#ifndef A11_FLOW_CATALOGUE_H_
18#define A11_FLOW_CATALOGUE_H_
25#include <absl/base/nullability.h>
26#include <absl/container/flat_hash_map.h>
27#include <nlohmann/json_fwd.hpp>
78 [[nodiscard]] std::vector<std::string>
PortNames(
99 std::vector<ActionInfo>
actions, std::vector<TypeInfo>
types = {},
100 absl::flat_hash_map<std::string, std::string>
intrinsics = {});
119 std::string_view
name)
const;
120 [[nodiscard]]
const TypeInfo* absl_nullable
Type(std::string_view tag)
const;
122 [[nodiscard]]
const std::vector<ActionInfo>&
actions()
const {
126 [[nodiscard]]
const std::vector<TypeInfo>&
types()
const {
return types_; }
128 const absl::flat_hash_map<std::string, std::string>&
intrinsics()
const {
133 return actions_.empty() && types_.empty() && intrinsics_.empty();
136 [[nodiscard]] nlohmann::json
ToJson()
const;
139 std::vector<ActionInfo> actions_;
140 std::vector<TypeInfo> types_;
141 absl::flat_hash_map<std::string, std::string> intrinsics_;
Everything the tools know about the world, in one place.
Definition catalogue.h:91
bool Empty() const
Definition catalogue.h:132
static Catalogue Of(std::vector< ActionInfo > actions, std::vector< TypeInfo > types={}, absl::flat_hash_map< std::string, std::string > intrinsics={})
Builds a catalogue from action and type entries.
Definition catalogue.cc:283
static Catalogue FromJson(const nlohmann::json &value)
The catalogue value describes, in the shape [ToJson] writes.
Definition catalogue.cc:293
const TypeInfo *absl_nullable Type(std::string_view tag) const
Definition catalogue.cc:494
const ActionInfo *absl_nullable Action(std::string_view name) const
Definition catalogue.cc:485
const std::vector< TypeInfo > & types() const
Definition catalogue.h:126
const std::vector< ActionInfo > & actions() const
Definition catalogue.h:122
const absl::flat_hash_map< std::string, std::string > & intrinsics() const
Definition catalogue.h:128
Catalogue MergedWith(const Catalogue &other) const
This catalogue with other laid over it.
Definition catalogue.cc:442
Program SchemaProgram() const
Interfaces and shapes used as analysis evidence by the native resolver.
Definition catalogue.cc:404
static const Catalogue & Builtin()
The embedded snapshot: what a standalone tool knows with nothing configured.
Definition catalogue.cc:503
nlohmann::json ToJson() const
Definition catalogue.cc:355
std::string value
Definition discover.cc:100
constexpr std::string_view kCatalogueFormat
The format field of the catalogue envelope.
Definition catalogue.h:145
PortDirection
Which side of the descriptor a port lands on, spelled as the plan spells it.
Definition syntax.h:624
Definition catalogue.cc:29
One compiled struct: a shape a port may be typed with.
Definition plan.h:87
Every flow and shape one source file declares.
Definition plan.h:200
One action a flow may run or call.
Definition catalogue.h:61
std::string name
Definition catalogue.h:62
std::vector< PortInfo > headers
Header names the action declares, with what each is for.
Definition catalogue.h:67
std::vector< PortInfo > inputs
Definition catalogue.h:64
std::vector< std::string > PortNames(syntax::PortDirection direction) const
Definition catalogue.cc:271
std::string description
Definition catalogue.h:63
std::optional< Origin > origin
Where the declaration is, when it was found by reading source.
Definition catalogue.h:69
std::vector< PortInfo > outputs
Definition catalogue.h:65
bool schema_complete
Source discovery may omit computed members; live schemas are complete.
Definition catalogue.h:74
std::vector< Origin > schema_origins
All interfaces contributing to the effective schema.
Definition catalogue.h:72
const PortInfo *absl_nullable Port(std::string_view port_name, syntax::PortDirection direction) const
Definition catalogue.cc:259
Source location of a discovered entry, with 1-based line and column.
Definition catalogue.h:39
int column
Definition catalogue.h:43
int line
Definition catalogue.h:42
std::string file
Path supplied to the scanner, retaining its absolute or relative form.
Definition catalogue.h:41
friend bool operator==(const Origin &, const Origin &)=default
One port of an action, as a tool needs to show it.
Definition catalogue.h:49
std::string description
Definition catalogue.h:54
std::string type
The type as the action's schema spells it: a Python type name, a serialisation tag,...
Definition catalogue.h:53
std::string name
Definition catalogue.h:50
bool unary
Whether the port carries one value rather than a stream.
Definition catalogue.h:57
bool required
Definition catalogue.h:55
A registered type, identified by its Flow tag and described as a [DtoPlan].
Definition catalogue.h:83
std::optional< Origin > origin
Where the declaration is, when it was found by reading source.
Definition catalogue.h:87
DtoPlan shape
Definition catalogue.h:85
std::string tag
Definition catalogue.h:84