Sources and registries
Collections of sources, units, schemas, functions, and node hierarchies.
-
struct Branch
- #include <list_branching.h>
Branch containing the cases selected during DIPL evaluation.
-
class BranchingList
- #include <list_branching.h>
Collection of DIPL branches and their selected cases.
Public Functions
-
inline BranchingList()
-
int register_case()
-
bool false_case()
-
void solve_case(const BaseNode::PointerType &node)
-
void prepare_node(const BaseNode::PointerType &node)
-
std::string clean_name(const std::string &node)
-
inline BranchingList()
-
struct Case
- #include <list_branching.h>
One conditional case in a DIPL branching structure.
-
struct Collection
- #include <list_hierarchy.h>
Information about a collection, keyed or indexed
-
struct EnvFunction
- #include <list_functions.h>
Traceable registered DIPL function.
Public Members
-
std::string id
Internal trace identifier, e.g. DIP0_FUNCTION0.
-
std::string name
Public function name used by DIPL.
-
FunctionKind kind
-
std::string id
-
struct EnvSchema
- #include <list_schema.h>
Reusable schema definition registered in a parsed DIPL environment.
Public Members
-
std::string name
-
std::string id
-
ValueMetadata metadata
Metadata on the definition, not inherited by instances.
-
size_t source_line
Declaration line, or first body line for host schemas.
-
std::string name
-
struct EnvSource
- #include <list_source.h>
Named DIPL source text together with its parsed nodes.
-
struct EnvUnit
- #include <list_unit.h>
Custom unit data
-
class FunctionList
- #include <list_functions.h>
Registry of functions callable from DIPL expressions.
Public Types
-
using DataFunctionType = std::function<ValueNodeData(const Environment&)>
-
using NodesFunctionType = std::function<ValueNode::ListType(const Environment&)>
Public Functions
-
void append_value(const std::string &name, DataFunctionType func, const std::string &parent_id = {})
Register a value function under a public name and trace parent identifier.
-
void append_nodes(const std::string &name, NodesFunctionType func, const std::string &parent_id = {})
Register a node-producing function under a public name and trace parent identifier.
-
DataFunctionType get_value(const std::string &name) const
Return the registered value-producing function.
- Parameters:
name – Function name to look up.
-
NodesFunctionType get_nodes(const std::string &name) const
-
const EnvFunction &get_value_info(const std::string &name) const
Return trace information for a registered value function.
-
const EnvFunction &get_nodes_info(const std::string &name) const
Return trace information for a registered node-producing function.
-
std::vector<EnvFunction> entries() const
Return trace information for all registered functions, ordered by name and kind.
-
using DataFunctionType = std::function<ValueNodeData(const Environment&)>
-
class HierarchyList
- #include <list_hierarchy.h>
The main class that manages node hierarchy
Public Functions
-
void record(const BaseNode::PointerType &node, const std::vector<NodeDtype> &excluded)
Register node into the node hierarchy
- Parameters:
node – Node that should be registed
excluded – List of node types that will be ignored in a node hierarchy
-
void record_parent(const BaseNode::PointerType &node)
Update indentation context without creating nodes or collection items.
-
const Path get_current_path(size_t indent = 0, const std::string &path = "", bool show_item = true) const
Get path of the current hierarchy level
If indent and path is not provided, method returns the most recent path composed from parents in the stack. When provided, the method returns path relative to the given indent. E.g. if current path is ‘foo.bar.baz’ and group ‘bar’ has indent 2, than for input indent 2 and path
crackle, the following path will be constructed:foo.crackle.The paramer
show_itemstrips the item from the end of the collection path: e.g. instead offoo[bar]onlyfoois returned
-
const std::unordered_map<std::string, Collection> &get_collections() const
Gets a reference on a ll collections
- Returns:
Map of all collections
-
const Collection &get_collection(const std::string &path) const
Get reference to a specific collection
- Parameters:
path – Collection fully qualified path
- Returns:
Referenc on a collection
-
void set_collection(const std::string &path, Path::Kind kind, std::vector<std::string> schemas)
Set a new collection
- Parameters:
path – Collection fully qualified path
kind – Collection kind (map/list)
schemas – List of schemas applied to collection items
-
void set_collection(const std::string &path, Path::Kind kind, std::vector<std::string> schemas, std::vector<std::string> items)
Restore a collection and its item order from persisted environment data.
-
void set_schemas(const std::string &path, std::vector<std::string> schemas)
Record schemas applied to an existing group or collection item.
-
const bool has_collection(const std::string &path) const
Test if collection whith the given path exists
- Parameters:
path – Collection path that should be found
- Returns:
Returns true if collection exists, otherwise returns false
-
const size_t num_collections() const
Get number of collections
- Returns:
Number of collections
-
void record(const BaseNode::PointerType &node, const std::vector<NodeDtype> &excluded)
-
template<typename T>
class NodeList - #include <list_node.h>
Ordered, named collection of DIPL nodes.
-
struct Parent
- #include <list_hierarchy.h>
Holds information about a paraent node in the hierarchy
Public Members
-
size_t indent
Indent of a parent node.
-
std::string name
Fully qualified node path.
-
std::vector<Path::CollectionAccess> collections
List of collections in the node path.
-
size_t indent
-
class SchemaList
- #include <list_schema.h>
Public Functions
-
SchemaList()
-
void append(const std::string &name, BaseNode::ListType &nodes, const std::string &parent_id = {}, const ValueMetadata &metadata = {}, size_t source_line = 0)
Append a schema definition to the registry.
- Parameters:
name – Name used to identify the item.
nodes – Nodes defining the schema.
parent_id – Internal identifier of the registering source.
metadata – Metadata attached to the schema definition.
-
SchemaList()
-
class SourceList
- #include <list_source.h>
Collection of named DIPL sources.
-
class UnitList
- #include <list_unit.h>
List of custom units
Public Functions
-
UnitList()
Unit list constructor
-
void append(const std::string &name, const std::string &definition, const std::string &parent_id = {})
Append new custom unit from a name and a definition expression
- Parameters:
name – Name of a custom unit
definition – Expression that defines a new unit
parent_id – Internal identifier of the registering source.
-
void append(const std::string &name, EnvUnit data, const std::string &parent_id = {})
Append new custom unit from a name and a custom unit data
- Parameters:
name – Name of a custom unit
data – Custom unit data object
parent_id – Internal identifier of the registering source.
-
EnvUnit &at(const std::string &name)
Select custom unit data
- Parameters:
name – Name of a custom unit
- Returns:
Custom unit data
-
UnitList()