#include <varname.h>
Public Member Functions | |
virtual | ~VarName () |
unsigned | insertVarname (const char *varname, bool force=false) |
Inserts a new string of a variable and returns the numeric value. | |
void | print (OutputStream &dos) |
Prints mapping of (numeric values of) variables to their string values. | |
const char * | getVarname (unsigned id) |
Returns string value for the entered (numeric value of a) variable. | |
const char * | getFreshVarname () |
Returns a new unused string to be used for a variable. | |
Static Public Member Functions | |
static VarName * | getInstance () |
Returns instance of VarName. | |
Private Member Functions | |
VarName () | |
Constructor. | |
Private Attributes | |
vector< const char * > | varnames |
int | index |
The highest numeric value of the (last) fresh variable. | |
Static Private Attributes | |
static VarName * | instance = NULL |
Instance of VarName. |
Represents mapping of numeric values of variables to their string value, which takes therefore a string, e.g. $x
or $y
, as arguments and returns the string value for a (numeric value of a) variable.
SINGLETON PATTERN!
Definition at line 60 of file varname.h.
VarName::~VarName | ( | ) | [virtual] |
VarName::VarName | ( | ) | [private] |
Constructor.
Constructor - creating object.
Definition at line 50 of file varname.cpp.
References ROOTVAR, and varnames.
Referenced by getInstance().
const char * VarName::getFreshVarname | ( | ) |
Returns a new unused string to be used for a variable.
Returns a new unused string to be used for a variable.
char* | Pointer to a char object. |
Definition at line 92 of file varname.cpp.
References index.
static VarName * VarName::getInstance | ( | ) | [static] |
Returns instance of VarName.
Returns instance of VarName, i.e. of this object.
VarName* | Pointer to a VarName object. |
Definition at line 42 of file varname.cpp.
References instance, and VarName().
Referenced by Executor::buildDependencies(), Executor::buildProjectionTree(), Executor::optimizeQuery(), Executor::parseQuery(), VarStepExpression::print(), VariableTreeNode::print(), VarExpression::print(), ProjectionTreeNode::print(), ProjectionTreeLabel::print(), PathEnvironment::print(), Environment::print(), Role::printExtended(), ForExpression::replaceVarId(), AggregateFunctExpression::rewriteAggregateFuncts(), SequenceExpression::rewriteVarsteps(), NodeConstructExpression::rewriteVarsteps(), IfExpression::rewriteVarsteps(), ForExpression::rewriteVarsteps(), ForExpression::scopeCheck(), and Executor::~Executor().
const char * VarName::getVarname | ( | unsigned | id | ) | [inline] |
Returns string value for the entered (numeric value of a) variable.
Returns string value for the entered (numeric value of a) variable.
[in] | id | Numeric value of a variable. |
char* | Pointer to a char object. |
Definition at line 99 of file varname.h.
References varnames.
Referenced by Executor::buildDependencies(), Executor::buildProjectionTree(), VarStepExpression::print(), VariableTreeNode::print(), VarExpression::print(), ProjectionTreeNode::print(), ProjectionTreeLabel::print(), PathEnvironment::print(), Environment::print(), Role::printExtended(), and ForExpression::scopeCheck().
unsigned VarName::insertVarname | ( | const char * | varname, | |
bool | force = false | |||
) |
Inserts a new string of a variable and returns the numeric value.
Inserts a new string of a variable and returns the numeric value.
[in] | varname | Pointer to a char object (string of a variable). |
[in] | force | true (default: false ) if force insertion of variable, false otherwise. |
unsigned | Numeric value for string value of a variable. |
Definition at line 64 of file varname.cpp.
References varnames.
Referenced by ForExpression::scopeCheck().
void VarName::print | ( | OutputStream & | dos | ) |
Prints mapping of (numeric values of) variables to their string values.
Prints mapping of (numeric values of) variables to their string values.
[in] | dos | Pointer to a OutputStream object. |
void |
Definition at line 82 of file varname.cpp.
References varnames.
Referenced by Executor::buildDependencies(), Executor::optimizeQuery(), and Executor::parseQuery().
int VarName::index [private] |
The highest numeric value of the (last) fresh variable.
The highest numeric value of the (last) fresh variable, which has been obtained from method getFreshVarname().
Definition at line 131 of file varname.h.
Referenced by getFreshVarname().
static VarName * VarName::instance = NULL [static, private] |
Instance of VarName.
Instance of VarName to avoid duplicate existence of this object.
Definition at line 113 of file varname.h.
Referenced by getInstance().
vector< const char * > VarName::varnames [private] |
The string values of all used variables.
Definition at line 124 of file varname.h.
Referenced by getVarname(), insertVarname(), print(), VarName(), and ~VarName().