#include <GsvScope.h>
Inherits std::enable_shared_from_this< GsvScope >.
|
bool | isEmpty () const |
|
const std::map< std::string, std::shared_ptr< std::string > > & | allVars () const |
|
fdk::StringSet | varNames () const |
| Get the list of all vars in this scope including the inherited ones.
|
|
bool | hasVar (const std::string &varname) const |
| Returns true if the named var is in the scope, either locally or inherited.
|
|
bool | hasLocalVar (const std::string &varname) const |
| Returns true if the named var is a local var in the scope.
|
|
std::optional< std::string > | valueOf (const std::string &varname) const |
| Returns a GSV value from the named var (<setname>.<varname>).
|
|
std::optional< std::string > | valueOf (const std::string &set, const std::string &key) const |
|
const GsvScopeId & | id () const |
|
const fdk::Hash & | hash () const |
| Returns the hash of all of its data, including parents.
|
|
const fdk::Hash & | localHash () const |
| Returns the hash of the local vars in this scope.
|
|
GsvScopePtr | parent () const |
| Returns the parent of the GsvScope.
|
|
GsvSets | localGsvSets () const |
| Returns the local override GsvSets held by the GsvScope.
|
|
const GsvScopePtr | build (const GsvSets &gsvSets) |
|
const std::map< std::string, std::vector< std::shared_ptr< std::string > > > & | data () const |
|
GsvScopePtr | ptr () |
| Returns a shared pointer to the GsvScope.
|
|
|
class | GsvRepository |
|
class | GsvScopeImpl |
|
std::ostream & | operator<< (std::ostream &os, const GsvScope &scope) |
| For debugging only, do not use for serialization.
|
|
A GsvScope is an immutable object that holds GsvSets. A Gsv is a Graph Scope Variable that is defined by a Node and set to a GsvScope during the Op tree generation. GSVs can be used in expressions, for example, a GSV named 'dir' used in a Read node file path like "/Volume/%dir" and can be resolved to different values depending on the GsvScope used in the context. A GsvScope can have a parent scope, which allows for the GsvScope to be extended and overriden. A GsvScope can be directly constructed via a GsvRepository, or indirectly via an existing GsvScope that will call the GsvRepository under the hood. The access to a GsvScope should be done via a GsvScopePtr returned either by a GsvRepository::build() or GsvScope::build() function. If a GsvScopePtr is empty, the scope should be considered nonexisting.
◆ allVars()
const std::map< std::string, std::shared_ptr< std::string > > & GsvScope::allVars |
( |
| ) |
const |
Get the flattened set of all vars with expanded names. Vars in custom GvsSets have names expanded to '<setname>.<varname>'.
◆ valueOf()
std::optional< std::string > GsvScope::valueOf |
( |
const std::string & |
set, |
|
|
const std::string & |
key |
|
) |
| const |
Returns a GSV value from a GsvSet in this scope. set is the name of the GsvSet to be searched for key. key is the GSV name to be searched. Returns an optional string with the GSV value, if found, or std::nullopt otherwise.
◆ id()
const GsvScopeId & GsvScope::id |
( |
| ) |
const |
Returns the unique ID for this scope which will change if any of its local or inherited vars change in name or value.
◆ build()
const GsvScopePtr GsvScope::build |
( |
const GsvSets & |
gsvSets | ) |
|
Returns a GsvSet with the given GsvSets and parented by the callee GsvSet. data is the GsvSets to be held by the GsvScope.
References ptr().
◆ data()
const std::map< std::string, std::vector< std::shared_ptr< std::string > > > & GsvScope::data |
( |
| ) |
const |
Returns all the GSV data used to create this scope in a flattened fashion. The key in this map is in the form <gsv-set-name>.<variable-name>. The value for each key is a vector with all the values the variable had during the scope construction. The order of the values is the reverse order of construction (most recent overrides comes first).