![]() |
rego-cpp 1.4.0
A C++ implementation of the Rego language and runtime
|
Represents a compiled Rego bundle. More...
#include <rego.hh>
Public Member Functions | |
| std::optional< size_t > | find_plan (const Location &name) const |
| Finds a plan by name. | |
| std::optional< size_t > | find_function (const Location &name) const |
| Finds a function by name. | |
| bool | is_function (const Location &name) const |
| Determines whether the provided name refers to a function. | |
| void | save (std::ostream &stream) const |
| Saves the bundle to a stream. | |
| void | save (const std::filesystem::path &path) const |
| Saves the bundle to a file. | |
Static Public Member Functions | |
| static Bundle | from_node (Node bundle) |
| Constructs a bundle from an AST node. | |
| static Bundle | load (std::istream &stream) |
| Loads a bundle from a stream. | |
| static Bundle | load (const std::filesystem::path &path) |
| Loads a bundle from a file. | |
Public Attributes | |
| Node | data |
| The merged base data document. | |
| std::map< Location, Node > | builtin_functions |
| The built-in functions required by the bundle. | |
| std::map< Location, size_t > | name_to_func |
| Map from plan names to their indices. | |
| std::map< Location, size_t > | name_to_plan |
| Map from function names to their indices. | |
| std::vector< bundle::Plan > | plans |
| The plans in the bundle. | |
| std::vector< bundle::Function > | functions |
| The functions in the bundle. | |
| std::vector< Location > | strings |
| The string table for the bundle. | |
| std::vector< Source > | files |
| The module source files which were compiled into the bundle. | |
| size_t | local_count |
| The number of local variables required by the bundle. | |
| std::optional< size_t > | query_plan |
| The index of the query plan, if one was included. | |
| Source | query |
| The query, if one was included. | |
Represents a compiled Rego bundle.
Finds a function by name.
| name | The name of the function to find. |
Finds a plan by name.
| name | The name of the plan to find. |
Constructs a bundle from an AST node.
The node provided must adhere to the wf_bundle well-formedness definition. Typically, this node is produced by the Interpreter method build.
| bundle | The AST node representing the bundle. |
Determines whether the provided name refers to a function.
| name | The name to check. |
Loads a bundle from a file.
The bundle is expected to be in Rego Bundle Binary format. To learn more about this format, see the specification.
| path | The path to the file to load from. |
Loads a bundle from a stream.
The bundle is expected to be in Rego Bundle Binary format. To learn more about this format, see the specification.
| stream | The stream to load from. |
Saves the bundle to a file.
The bundle is saved in Rego Bundle Binary format. To learn more about this format, see the specification.
| path | The path to the file to save to. |
| void rego::BundleDef::save | ( | std::ostream & | stream | ) | const |
Saves the bundle to a stream.
The bundle is saved in Rego Bundle Binary format. To learn more about this format, see the specification.
| stream | The stream to save to. |