Represents a compiled Rego bundle.
More...
#include <rego.hh>
|
| 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 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.
|
| |
|
|
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.
◆ find_function()
| std::optional< size_t > rego::BundleDef::find_function |
( |
const Location & | name | ) |
const |
Finds a function by name.
- Parameters
-
| name | The name of the function to find. |
- Returns
- The index of the function if found, otherwise std::nullopt.
◆ find_plan()
| std::optional< size_t > rego::BundleDef::find_plan |
( |
const Location & | name | ) |
const |
Finds a plan by name.
- Parameters
-
| name | The name of the plan to find. |
- Returns
- The index of the plan if found, otherwise std::nullopt.
◆ from_node()
| static Bundle rego::BundleDef::from_node |
( |
Node | bundle | ) |
|
|
static |
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.
- Parameters
-
| bundle | The AST node representing the bundle. |
- Returns
- The bundle.
◆ is_function()
| bool rego::BundleDef::is_function |
( |
const Location & | name | ) |
const |
Determines whether the provided name refers to a function.
- Parameters
-
- Returns
- True if the name refers to a function, otherwise false.
◆ load() [1/2]
| static Bundle rego::BundleDef::load |
( |
const std::filesystem::path & | path | ) |
|
|
static |
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.
- Parameters
-
| path | The path to the file to load from. |
- Returns
- The bundle, or null if the bundle could not be loaded.
◆ load() [2/2]
| static Bundle rego::BundleDef::load |
( |
std::istream & | stream | ) |
|
|
static |
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.
- Parameters
-
| stream | The stream to load from. |
- Returns
- The bundle, or null if the bundle could not be loaded.
◆ save() [1/2]
| void rego::BundleDef::save |
( |
const std::filesystem::path & | path | ) |
const |
Saves the bundle to a file.
The bundle is saved in Rego Bundle Binary format. To learn more about this format, see the specification.
- Parameters
-
| path | The path to the file to save to. |
◆ save() [2/2]
| 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.
- Parameters
-
| stream | The stream to save to. |
The documentation for this struct was generated from the following file: