IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.InterpreterVariable Class Reference

Base class for interpreter variables. More...

+ Collaboration diagram for IG.Lib.InterpreterVariable:

Public Member Functions

 InterpreterVariable (string variableName, int stackLevel=StackLevelDefault, string variableValue=null, VariableFlags flags=VariableFlags.Default)
 Constructs a new interpreter variable. More...
 
void SetReferencedVariable (InterpreterVariable referencedVariable, string referencedVariableName=null, int referencedVariableStackLevel=StackLevelDefault)
 Sets the the variable reference, which defines the variable that the current variable references. More...
 
override string ToString ()
 Returns a string that describes the current interpreter variable. More...
 

Public Attributes

const int StackLevelGlobal = -1
 Stack level used for global variables. More...
 
const int StackLevelUndefined = -2
 Stack level used for variables that are neither local or global (or for which stack level is unknown). More...
 
const int StackLevelDefault = StackLevelUndefined
 Default stack level - StackLevelUndefined More...
 

Properties

string Name [get, protected set]
 Variable name. More...
 
int StackLevel [get, protected set]
 Specifies the stack level of the local variable and whether the variable is local or global. More...
 
bool IsGlobal [get]
 Gets a flag indicating whether the current variable is a global variable. More...
 
bool IsLocal [get]
 Gets a flag indicating whether the current variable is a global variable. More...
 
string StringValue [get, set]
 String value of the variable. More...
 
VariableFlags Flags [get, protected set]
 Flags that define type and behavior of the variable. More...
 
bool IsValid [get, set]
 Indicates whether the variable is valid and can be used (i.e., is defined). More...
 
bool IsReference [get, protected set]
 Indicates whether the variable is a reference to another variable. More...
 
InterpreterVariable ReferencedVariable [get, protected set]
 Reference to the variable that is referenced by the current variable. More...
 
int ReferencedVariableStackLevel [get, protected set]
 Gets the stack level of the referenced variable. More...
 
string ReferencedVariableName [get, protected set]
 Gets the referenced variable name. More...
 
bool IsReferencedVariableLocal [get]
 Gets a flag indicating whether the current variable references a local variable. More...
 
bool IsReferencedVariableGlobal [get]
 Gets a flag indicating whether the current variable references a global variable. More...
 
int ReferencedVariableLevelsBelow [get]
 Gets the number of stack levels for which the referenced variable is defined below the current variable. More...
 

Private Member Functions

 InterpreterVariable ()
 

Private Attributes

string _variableName
 
int _stackLevel = -1
 
string _stringValue
 
VariableFlags _flags = VariableFlags.Default
 
InterpreterVariable _referencedVar
 
int _referencedVariableStackLevel = StackLevelDefault
 
string _referencedVariableName = null
 

Detailed Description

Base class for interpreter variables.

$A Igor Oct15;

Constructor & Destructor Documentation

IG.Lib.InterpreterVariable.InterpreterVariable ( )
inlineprivate
IG.Lib.InterpreterVariable.InterpreterVariable ( string  variableName,
int  stackLevel = StackLevelDefault,
string  variableValue = null,
VariableFlags  flags = VariableFlags.Default 
)
inline

Constructs a new interpreter variable.

Parameters
variableNameVariable name. Must be specified.
stackLevelStack level.
variableValueString value of the variable. Can be null.
flagsFlags that define type and behavior of the variable. Default is VariableFlags.Default

Member Function Documentation

void IG.Lib.InterpreterVariable.SetReferencedVariable ( InterpreterVariable  referencedVariable,
string  referencedVariableName = null,
int  referencedVariableStackLevel = StackLevelDefault 
)
inline

Sets the the variable reference, which defines the variable that the current variable references.

Exception is thrown if the current variable is not a reference variable.

Parameters
referencedVariableVariable that will be referenced by the current variable.

Normally, this is required information for reference variables, but can be set undefined.

Parameters
referencedVariableNameName of the referenced variable. This is auxiliary information and is usually provided only when the name referencedVariable is not specified (i.e., it is a null reference).
referencedVariableStackLevelThe stack level of the referenced variable.
override string IG.Lib.InterpreterVariable.ToString ( )
inline

Returns a string that describes the current interpreter variable.

Member Data Documentation

string IG.Lib.InterpreterVariable._variableName
private
int IG.Lib.InterpreterVariable._stackLevel = -1
private
const int IG.Lib.InterpreterVariable.StackLevelGlobal = -1

Stack level used for global variables.

const int IG.Lib.InterpreterVariable.StackLevelUndefined = -2

Stack level used for variables that are neither local or global (or for which stack level is unknown).

const int IG.Lib.InterpreterVariable.StackLevelDefault = StackLevelUndefined

Default stack level - StackLevelUndefined

string IG.Lib.InterpreterVariable._stringValue
private
VariableFlags IG.Lib.InterpreterVariable._flags = VariableFlags.Default
private
InterpreterVariable IG.Lib.InterpreterVariable._referencedVar
private
int IG.Lib.InterpreterVariable._referencedVariableStackLevel = StackLevelDefault
private
string IG.Lib.InterpreterVariable._referencedVariableName = null
private

Property Documentation

string IG.Lib.InterpreterVariable.Name
getprotected set

Variable name.

Normally, this will coincide with the name through which the variable is referenced in the interpreter.

int IG.Lib.InterpreterVariable.StackLevel
getprotected set

Specifies the stack level of the local variable and whether the variable is local or global.

Greater or equal to 0 means that the variable is a local variable defined on the stack frame of the specified level.

-1 means that the variable is global.

Less than -1 meand that the variable is neither local nor global (usually, this indicates an error).

bool IG.Lib.InterpreterVariable.IsGlobal
getprivate

Gets a flag indicating whether the current variable is a global variable.

bool IG.Lib.InterpreterVariable.IsLocal
getprivate

Gets a flag indicating whether the current variable is a global variable.

string IG.Lib.InterpreterVariable.StringValue
getset

String value of the variable.

Variables of the commandline interpreter (ICommandLineApplicationInterpreter) normally have string values.

Referenced by IG.Lib.CommandStackFrameBase.SetVariableValue(), and IG.Lib.CommandStackFrameBase.SetVariableValueLocked().

VariableFlags IG.Lib.InterpreterVariable.Flags
getprotected set

Flags that define type and behavior of the variable.

Referenced by IG.Lib.CommandStackFrameBase.SetVariableValue(), and IG.Lib.CommandStackFrameBase.SetVariableValueLocked().

bool IG.Lib.InterpreterVariable.IsValid
getset

Indicates whether the variable is valid and can be used (i.e., is defined).

Can be get and set.

When a variable is removed, its valid flag will be set to false. In this way, variables that evantually reference this variable will know that their reference is invalid.

bool IG.Lib.InterpreterVariable.IsReference
getprotected set

Indicates whether the variable is a reference to another variable.

InterpreterVariable IG.Lib.InterpreterVariable.ReferencedVariable
getprotected set

Reference to the variable that is referenced by the current variable.

int IG.Lib.InterpreterVariable.ReferencedVariableStackLevel
getprotected set

Gets the stack level of the referenced variable.

Exceptions
InvalidOperationExceptionThrown when the current variable is not a reference to another variable.
string IG.Lib.InterpreterVariable.ReferencedVariableName
getprotected set

Gets the referenced variable name.

Exceptions
InvalidOperationExceptionThrown when the current variable is not a reference to another variable.
bool IG.Lib.InterpreterVariable.IsReferencedVariableLocal
get

Gets a flag indicating whether the current variable references a local variable.

Exceptions
InvalidOperationExceptionThrown when the current variable is not a reference to another variable.
InvalidOperationExceptionThrown when the current variable is not a reference to another variable.
bool IG.Lib.InterpreterVariable.IsReferencedVariableGlobal
get

Gets a flag indicating whether the current variable references a global variable.

Exceptions
InvalidOperationExceptionThrown when the current variable is not a reference to another variable.
int IG.Lib.InterpreterVariable.ReferencedVariableLevelsBelow
get

Gets the number of stack levels for which the referenced variable is defined below the current variable.

Exceptions
InvalidOperationExceptionThrown when the current variable is not a reference to another variable, or the referenced variable is not a local variable, or the current variable is not a local variable..

The documentation for this class was generated from the following file: