VarName Class Reference

Represents mapping of numeric values of variables to their string value. More...

#include <varname.h>

Collaboration diagram for VarName:

Collaboration graph
[legend]

List of all members.

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 VarNamegetInstance ()
 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 VarNameinstance = NULL
 Instance of VarName.


Detailed Description

Represents mapping of numeric values of variables to their string value.

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.

Note:
Variables are internally represented by numbers!

SINGLETON PATTERN!

Author:
Michael Schmidt

Gunnar Jehl

Version:
2.1
License:
Software License Agreement (BSD License)

Definition at line 60 of file varname.h.


Constructor & Destructor Documentation

VarName::~VarName (  )  [virtual]

Destructor.

Definition at line 58 of file varname.cpp.

References varnames.

VarName::VarName (  )  [private]

Constructor.

Constructor - creating object.

Definition at line 50 of file varname.cpp.

References ROOTVAR, and varnames.

Referenced by getInstance().


Member Function Documentation

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.

Return values:
char* Pointer to a char object.

Definition at line 92 of file varname.cpp.

References index.

static VarName * VarName::getInstance (  )  [static]

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.

Parameters:
[in] id Numeric value of a variable.
Return values:
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.

Parameters:
[in] varname Pointer to a char object (string of a variable).
[in] force true (default: false) if force insertion of variable, false otherwise.
Return values:
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.

Parameters:
[in] dos Pointer to a OutputStream object.
Return values:
void 

Definition at line 82 of file varname.cpp.

References varnames.

Referenced by Executor::buildDependencies(), Executor::optimizeQuery(), and Executor::parseQuery().


Member Data Documentation

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().


Generated on Sun May 24 20:20:31 2009 for G(arbage) C(ollected) X(Query) Engine by  doxygen 1.5.9