The Vish Visualization Shell 0.3
Vish
Classes | Public Member Functions | Static Public Member Functions | List of all members
Eagle::Context Class Referenceabstract

A set of variable names, with indices associated to each type. More...

#include <ocean/parzival/Context.hpp>

Inheritance diagram for Eagle::Context:
Eagle::ParserContext

Classes

struct  Iterator
 Iterator functor that allows to travers over all variables of a specific type. More...
 
struct  VariableList
 

Public Member Functions

virtual bool accessVariable (const type_info &type, const Context::id_t &id, const string &name)
 Allow a derived parser context to determine if a specific variable has actually been used in the parsing process at all.
 
size_t findNumberOfVariables (const type_info &type) const
 Inspect how many variables exist of the given type.
 
id_t findVariable (const type_info &type, const string &s) const
 Find a variable of the given type and name.
 
virtual string getToken () const =0
 Get the currently processed token.
 
int iterate (const type_info &type, Iterator &it)
 Iterate over all variables of a specific type.
 

Static Public Member Functions

template<class Type >
static bool isVariable (Context &C, id_t &id)
 Look up the current getToken() of the Context if it is known as a valid variable in this Context, and of the certain type.
 

Detailed Description

A set of variable names, with indices associated to each type.

Examples
AnemoneBoundingVolume.cpp, Background.cpp, DynamicBackground.cpp, InteractivePoint.cpp, MonochromeBackground.cpp, QuadDemo.cpp, and SeagrassBoundingVolume.cpp.

Member Function Documentation

◆ accessVariable()

bool Eagle::Context::accessVariable ( const type_info &  type,
const Context::id_t &  id,
const string &  name 
)
virtual

Allow a derived parser context to determine if a specific variable has actually been used in the parsing process at all.

A typical scenario where this is useful is when the value of a variable would be effortsome to compute, or involves retrieving data from disk or network, etc.

Parameters
typeThe type of the variable
idThe variable identification number
nameThe textual name of the variable
Note
A future version could allow a derived parser to declare a specific variable as being "unavailable", depending on external circumstances. If so, it could trigger a syntax error. It needs to be investigated if such could be a useful scenario.
Returns
Should return always true, otherwise indicates the variable shall not be used.

Referenced by isVariable().

◆ isVariable()

template<class Type >
static bool Eagle::Context::isVariable ( Context C,
id_t &  id 
)
inlinestatic

Look up the current getToken() of the Context if it is known as a valid variable in this Context, and of the certain type.

If so, call the virtual accessVariable() function of the Context to tell the Context about the usage of this variable, and which type.

References accessVariable(), findVariable(), and getToken().