| IGLib 1.7.2 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Member Functions | Protected Member Functions | Protected Attributes | Properties | Private Attributes | List of all members
IG.Lib.CommandStackFrameBase Class Referenceabstract

Base class for classes of type CommandStackFrame{InterpreterType, ThreadType}see cref=""/>. Contains everyting that does not depend on specific type of generic parameters. More...

Inheritance diagram for IG.Lib.CommandStackFrameBase:
[legend]

## Public Member Functions
| CommandStackFrameBase ()
abstract ICommandLineApplicationInterpreter | GetInterpreterBase ()
| Returns the commans-line interpreter to which the current command thread belongs. More...
abstract CommandThreadBase | GetThreadBase ()
| Returns the stack frame of the specified level for the current thread. More...
void | AddBlockEnterCommands (params string[] commands)
| Adds the specified strings to the list of commands that can enter the current kind of the code block. More...
void | AddBlockExitCommands (params string[] commands)
| Adds the specified strings to the list of commands that can exit the current kind of the code block. More...
void | AddBlockExitCommandsNoLevelEffect (params string[] commands)
| Adds the specified strings to the list of commands that can exit the current kind of the code block, but don't affect the quiet entry/exit level. More...
string[] | GetBlockEnterCommands ()
| Returns the array of commands that can enter the current kind of code block. More...
string[] | GetBlockExitCommands ()
| Returns the array of commands that can exit the current kind of code block. More...
string[] | GetBlockExitCommandsNoLevelEffect ()
| Returns the array of commands that can exit the current kind of code block but have no level effect. More...
bool | IsEventualBlockEnterCommand (string commandLine, bool isOnlyCommandName=false)
| Returns true if the specified commandline can eventually represent one of the commands contained in the list of possible block enter commands for the current kind of code block. More...
bool | IsEventualBlockExitCommand (string commandLine, bool isOnlyCommandName=false)
| Returns true if the specified commandline can eventually represent one of the commands contained in the list of possible block exit commands for the current kind of code block. More...
bool | IsEventualBlockExitCommandNoLevelEffect (string commandLine, bool isOnlyCommandName=false)
| Returns true if the specified commandline can eventually represent one of the commands contained in the list of possible block exit commands that do not affect quiet entry/exit level, for the current kind of code block. More...
bool | CheckForBlockEnterOrExitCommand (string commandLine, bool justCheck=false, bool isOnlyCommandName=false)
| Inspects the specified commandline and checks whether it can represent a block enter or a block exit command for the currennt code block. More...
bool | IsBlockExitQuietCommand (string commandLine, bool isOnlyCommandName=false)
| Returns true if the specified command should be executed as block exit command, in spite of the fact that commannd execution is currently switched off on the current code block. More...
bool | IsVariableDefined (string varName)
| Returns true if the specified variable is defined, false if it is not. More...
bool | IsVariableDefinedLocked (string varName)
| Returns true if the specified variable is defined, false if it is not. More...
InterpreterVariable | GetVariableDef (string varName)
| Returns variable object (definition) for the variable with specified name. More...
string | GetVariableValue (string varName)
| Returns value of the specified variable. More...
string | GetVariableValueLocked (string varName)
| Gets the variable within lock on the Lock property and returns it. More...
void | SetVariableValue (string varName, string varValue, VariableFlags flags=VariableFlags.Default)
| Sets value of the specified variable. More...
void | SetVariableValueLocked (string varName, string varValue, VariableFlags flags=VariableFlags.Default)
| Sets the variable within lock on the property. More...
void | RemoveVariable (string varName)
| Removes the specified variable. More...
void | RemoveVariableLocked (string varName)
| Removes the specified variable within lock on the property. More...
string | ToStringVariableNames ()
string | ToStringVariableValues ()
virtual string | ToString (bool includeThreadInfo=true, bool includeLocalVariables=true, bool includeGlobalVariables=true)
| Returns a string containing information about the current command thread. More...
override string | ToString ()
| Returns string representation of the current object. More...

## Protected Member Functions
bool | IsEventualListedCommand (string commandLine, List< string > commands, bool isOnlyCommandName=false)
| Returns true if the specified commandline can eventually represent one of the commands contained in the specified list of commands. More...

## Protected Attributes
int | _quietBlockLevel = 0
SortedDictionary< string, InterpreterVariable > | _variables = new SortedDictionary<string, InterpreterVariable>()
| Local variables. More...
List< string > | _auxVarNames = null

## Properties
object | Lock`[get]`
| This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock. More...
int | StackLevel`[get, protected set]`
List< string > | BlockEnterCommands`[get]`
| A list of commands that can enter the type of the current code block. More...
List< string > | BlockExitCommands`[get]`
| A list of commands that can exit the type of the current code block. More...
List< string > | BlockExitCommandsNoLevelEffect`[get]`
| A list of commands that can exit the type of the current code block, but willl nnot have effect on the quet wxit/entry level. More...
int | QuietBlockEntryLevel`[get, protected set]`
| Indicates the quiet entry/exit level of the current kind of block when commands are not executed. More...
CodeBlockType | BlockType`[get, protected set]`
| Type of the code block represented by the current stack frame. More...
bool | DoExecuteCommands`[get, set]`
| Whether commands are executed in the current code block. More...
bool | WasBranchAlreadyExecuted`[get, set]`
| Whether a branch has already been executed. More...
int | NumExitLevels`[get, set]`
int | LoopCount`[get, set]`
| Whether commands are executed in the current code block. More...
bool | SuppressInteractive`[get, set]`
| Indicates that the interactive mode is temporarily represset. More...
string | ConditionExpression`[get, set]`
| For loopig and branching blocks, this property contains the condition expression of the block, which was a part of the block command (such as While, If, or ElseIf). More...
string | BlockCommanddLine`[get, set]`
| Commandline that started the current block. It may have been saved when the current block of code was entered, in order to be used within the block (e.g. for inspection and debugging) or when the block exits. Typical use is in blocks with deferred evaluation, such as in While block, where commandlines within the block are stored first, and then repeatedly evaluated until the condition from the While block entering command is fulfilled. More...
bool | DoSaveCommands`[get, set]`
| Whether commands are saved to the command store in the current code block. More...
List< string > | CommandLines`[get]`
string | LastCommandLine`[get, set]`
string | ReturnedValue`[get, set]`
| Value returned from the last executed command. More...
string[] | VariableNames`[get]`
| Gets names of all variables that are defined on the current stack frame. More...
string[] | VariableValueStrings`[get]`
| Gets names of all variables that are defined on the current stack frame. More...
InterpreterVariable | this[string variableName]`[get, set]`
| Gets or sets value of the variable with the specified name. More...

## Private Attributes
object | _mainLock = new object()
int | _stackLevel = 0
List< string > | _blockEnterCommands = null
List< string > | _blockExitCommands = null
List< string > | _blockExitCommandsNoLevelffect = null
CodeBlockType | _blockType = CodeBlockType.None
bool | _doExecute = true
bool | _isBranchExecuted = false
int | _numExitLevels = 0
int | _loopCount = 0
bool | _suppressInteractive = false
string | _conditionExpression = null
string | _blockCommandLine = null
bool | _doSave = false
List< string > | _commandLines = null
string | _lastCommandLine = null
string | _returnedValue = null

## Detailed Description

Base class for classes of type CommandStackFrame{InterpreterType, ThreadType}see cref=""/>. Contains everyting that does not depend on specific type of generic parameters.

## Constructor & Destructor Documentation

IG.Lib.CommandStackFrameBase.CommandStackFrameBase | ( |  | ) |
| inline

## Member Function Documentation

abstract ICommandLineApplicationInterpreter IG.Lib.CommandStackFrameBase.GetInterpreterBase | ( |  | ) |
| pure virtual

Returns the commans-line interpreter to which the current command thread belongs.

WARNING: This method is intended for use in the base classes; use more specific (type dependent) methods in derived classes.

Implemented in IG.Lib.CommandStackFrame< InterpreterType, ThreadType >.

abstract CommandThreadBase IG.Lib.CommandStackFrameBase.GetThreadBase | ( |  | ) |
| pure virtual

Returns the stack frame of the specified level for the current thread.

WARNING: This method is intended for use in the base classes; use more specific (type dependent) methods in derived classes.

Command thread (if not replicated for another one) begins executon at stack level 0, then each command block or function call increments the stack level by creating a new stack frame.

Implemented in IG.Lib.CommandStackFrame< InterpreterType, ThreadType >.

void IG.Lib.CommandStackFrameBase.AddBlockEnterCommands | ( | params string[] | commands | ) |
| inline

Adds the specified strings to the list of commands that can enter the current kind of the code block.

Warnig: Kind of the code block is not defined by the CodeBlockType in this context, because each type listed in the enumeration can refer to several customly defined subtypes of code blocks.

This list is used as list of commands to be monitored when in the non-executable mode (where commands are not actually executed) in order to know when the command is hit that will end the block, and therefore exit the block that is in non-executable more.

Parameters

  commands | Commands that are added to the list of commands that can enter the current kind of block.

void IG.Lib.CommandStackFrameBase.AddBlockExitCommands | ( | params string[] | commands | ) |
| inline

Adds the specified strings to the list of commands that can exit the current kind of the code block.

Warnig: Kind of the code block is not defined by the CodeBlockType in this context, because each type listed in the enumeration can refer to several customly defined subtypes of code blocks.

This list is used as list of commands to be monitored when in the non-executable mode (where commands are not actually executed) in order to know when the command is hit that will end the block, and therefore exit the block that is in non-executable more.

Parameters

  commands | Commands that are added to the list of commands that can enter the current kind of block.

void IG.Lib.CommandStackFrameBase.AddBlockExitCommandsNoLevelEffect | ( | params string[] | commands | ) |
| inline

Adds the specified strings to the list of commands that can exit the current kind of the code block, but don't affect the quiet entry/exit level.

Warnig: Kind of the code block is not defined by the CodeBlockType in this context, because each type listed in the enumeration can refer to several customly defined subtypes of code blocks.

This list is used as list of commands to be monitored when in the non-executable mode (where commands are not actually executed) in order to know when the command is hit that will end the block, and therefore exit the block that is in non-executable more.

Example is If/Else/Endif blocks. Both Else and Endif can exit the If block, but in quiet mode, only Endif should decrease the quiet entry/exit level (becauee only If increases it, and If always have the cottesponding EndIf).

Parameters

  commands | Commands that are added to the list of commands that can enter the current kind of block.

string [] IG.Lib.CommandStackFrameBase.GetBlockEnterCommands | ( |  | ) |
| inline

Returns the array of commands that can enter the current kind of code block.

string [] IG.Lib.CommandStackFrameBase.GetBlockExitCommands | ( |  | ) |
| inline

Returns the array of commands that can exit the current kind of code block.

string [] IG.Lib.CommandStackFrameBase.GetBlockExitCommandsNoLevelEffect | ( |  | ) |
| inline

Returns the array of commands that can exit the current kind of code block but have no level effect.

bool IG.Lib.CommandStackFrameBase.IsEventualListedCommand | ( | string | commandLine,
|  | List< string > | commands,
|  | bool | isOnlyCommandName = `false`
| ) |  |
| inline protected

Returns true if the specified commandline can eventually represent one of the commands contained in the specified list of commands.

The conclusion returned is not definitive because it does not take into account whether the interpreter is case sensitive or not. It does check, however, that the command name is the first non-whitespace substring appearing in the command, and that it is separate by whitespace characters from eventual subsequeent parts of the string.

Parameters

  commandLine | Command lne that is check for whetherr it can represent one of the commands listed.
  commands | A list of command names that are checked.
  isOnlyCommandName | If true then commandLine represents only the command name (stripped off eventual arguments and whitespace).

References IG.Lib.UtilStr.GetArgumentsArray().

bool IG.Lib.CommandStackFrameBase.IsEventualBlockEnterCommand | ( | string | commandLine,
|  | bool | isOnlyCommandName = `false`
| ) |  |
| inline

Returns true if the specified commandline can eventually represent one of the commands contained in the list of possible block enter commands for the current kind of code block.

The conclusion returned is not definitive because it does not take into account whether the interpreter is case sensitive or not. It does check, however, that the command name is the first non-whitespace substring appearing in the command, and that it is separate by whitespace characters from eventual subsequeent parts of the string.

Parameters

  commandLine | Command lne that is check for whetherr it can represent one of the commands listed.
  isOnlyCommandName | If true then commandLine represents only the command name (stripped off eventual arguments and whitespace).

bool IG.Lib.CommandStackFrameBase.IsEventualBlockExitCommand | ( | string | commandLine,
|  | bool | isOnlyCommandName = `false`
| ) |  |
| inline

Returns true if the specified commandline can eventually represent one of the commands contained in the list of possible block exit commands for the current kind of code block.

The conclusion returned is not definitive because it does not take into account whether the interpreter is case sensitive or not. It does check, however, that the command name is the first non-whitespace substring appearing in the command, and that it is separate by whitespace characters from eventual subsequeent parts of the string.

Parameters

  commandLine | Command lne that is check for whetherr it can represent one of the commands listed.
  isOnlyCommandName | If true then commandLine represents only the command name (stripped off eventual arguments and whitespace).

bool IG.Lib.CommandStackFrameBase.IsEventualBlockExitCommandNoLevelEffect | ( | string | commandLine,
|  | bool | isOnlyCommandName = `false`
| ) |  |
| inline

Returns true if the specified commandline can eventually represent one of the commands contained in the list of possible block exit commands that do not affect quiet entry/exit level, for the current kind of code block.

The conclusion returned is not definitive because it does not take into account whether the interpreter is case sensitive or not. It does check, however, that the command name is the first non-whitespace substring appearing in the command, and that it is separate by whitespace characters from eventual subsequeent parts of the string.

Parameters

  commandLine | Command lne that is check for whetherr it can represent one of the commands listed.
  isOnlyCommandName | If true then commandLine represents only the command name (stripped off eventual arguments and whitespace).

bool IG.Lib.CommandStackFrameBase.CheckForBlockEnterOrExitCommand | ( | string | commandLine,
|  | bool | justCheck = `false`,
|  | bool | isOnlyCommandName = `false`
| ) |  |
| inline

Inspects the specified commandline and checks whether it can represent a block enter or a block exit command for the currennt code block.

Parameters

  commandLine | Commandline to be checked.
  justCheck | If true then the function only performs the check, but does not increment or decrement the level of encountered current block entries/exits. Default is false.
  isOnlyCommandName | If true then commandLine

is treated as command name, i.e. it should not contain additional arguments and / or whitespaces.

Returns
  True if the specfied commandline can eventually represent the current non-executing code block entry or exit command.

bool IG.Lib.CommandStackFrameBase.IsBlockExitQuietCommand | ( | string | commandLine,
|  | bool | isOnlyCommandName = `false`
| ) |  |
| inline

Returns true if the specified command should be executed as block exit command, in spite of the fact that commannd execution is currently switched off on the current code block.

This makes possible to hit the block exit command for code blocks that have been entered, but command execution was then switched off (e.g. in order to defer command evaluation after all commands are known).

This method only perfomrs checks and does not increase or decrease the quied block entry/exit level.

If command execution is switched on then the method returnes false (in order to save time for actual checks).

Parameters

  commandLine | Commadline that is checked.
  isOnlyCommandName | If true then commandLine is treated as just the command name, i.e. it must not contain eventual whitespaces or parameters.

bool IG.Lib.CommandStackFrameBase.IsVariableDefined | ( | string | varName | ) |
| inline

Returns true if the specified variable is defined, false if it is not.

Parameters

  varName | Name of the variable that is queried.

bool IG.Lib.CommandStackFrameBase.IsVariableDefinedLocked | ( | string | varName | ) |
| inline

Returns true if the specified variable is defined, false if it is not.

Thread safe variant, lock is aquired on Lock.

Parameters

  varName | Name of the variable that is queried.

InterpreterVariable IG.Lib.CommandStackFrameBase.GetVariableDef | ( | string | varName | ) |
| inline

Returns variable object (definition) for the variable with specified name.

null is returned if the variable does not exist.

Parameters

  varName | Name of the variable.

string IG.Lib.CommandStackFrameBase.GetVariableValue | ( | string | varName | ) |
| inline

Returns value of the specified variable.

Parameters

  varName | Name of the variable.

string IG.Lib.CommandStackFrameBase.GetVariableValueLocked | ( | string | varName | ) |
| inline

Gets the variable within lock on the Lock property and returns it.

Thread safe variant, lock is aquired on Lock.

Parameters

  varName | Name of the variable whose value is to be reurned.

void IG.Lib.CommandStackFrameBase.SetVariableValue | ( | string | varName,
|  | string | varValue,
|  | VariableFlags | flags = `VariableFlags.Default`
| ) |  |
| inline

Sets value of the specified variable.

Parameters

  varName | Name of the variable to be set.
  varValue | Value to be assigned to the specified variable.
  flags | Variable flags (optional).

References IG.Lib.InterpreterVariable.Flags, and IG.Lib.InterpreterVariable.StringValue.

void IG.Lib.CommandStackFrameBase.SetVariableValueLocked | ( | string | varName,
|  | string | varValue,
|  | VariableFlags | flags = `VariableFlags.Default`
| ) |  |
| inline

Sets the variable within lock on the property.

Thread safe variant, lock is aquired on Lock.

Parameters

  varName | Name of the variable whose value is to be set.
  varValue | Value to be assigned to the variable.
  flags | Variable flags (optional).

References IG.Lib.InterpreterVariable.Flags, and IG.Lib.InterpreterVariable.StringValue.

void IG.Lib.CommandStackFrameBase.RemoveVariable | ( | string | varName | ) |
| inline

Removes the specified variable.

Parameters

  varName | Name of the variable to be removed.

void IG.Lib.CommandStackFrameBase.RemoveVariableLocked | ( | string | varName | ) |
| inline

Removes the specified variable within lock on the property.

Thread safe variant, lock is aquired on Lock.

Parameters

  varName | Name of the variable whose value is to be set.

string IG.Lib.CommandStackFrameBase.ToStringVariableNames | ( |  | ) |
| inline

Referenced by IG.Lib.CommandStackFrameBase.ToString().

string IG.Lib.CommandStackFrameBase.ToStringVariableValues | ( |  | ) |
| inline

Referenced by IG.Lib.CommandStackFrameBase.ToString().

virtual string IG.Lib.CommandStackFrameBase.ToString | ( | bool | includeThreadInfo = `true`,
|  | bool | includeLocalVariables = `true`,
|  | bool | includeGlobalVariables = `true`
| ) |  |
| inline virtual

Returns a string containing information about the current command thread.

References IG.Lib.ICommandLineApplicationInterpreter.GlobalFrame, IG.Lib.CommandStackFrameBase.ToStringVariableNames(), and IG.Lib.CommandStackFrameBase.ToStringVariableValues().

override string IG.Lib.CommandStackFrameBase.ToString | ( |  | ) |
| inline

Returns string representation of the current object.

## Member Data Documentation

object IG.Lib.CommandStackFrameBase._mainLock = new object()
| private

int IG.Lib.CommandStackFrameBase._stackLevel = 0
| private

List<string> IG.Lib.CommandStackFrameBase._blockEnterCommands = null
| private

List<string> IG.Lib.CommandStackFrameBase._blockExitCommands = null
| private

List<string> IG.Lib.CommandStackFrameBase._blockExitCommandsNoLevelffect = null
| private

int IG.Lib.CommandStackFrameBase._quietBlockLevel = 0
| protected

CodeBlockType IG.Lib.CommandStackFrameBase._blockType = CodeBlockType.None
| private

bool IG.Lib.CommandStackFrameBase._doExecute = true
| private

bool IG.Lib.CommandStackFrameBase._isBranchExecuted = false
| private

int IG.Lib.CommandStackFrameBase._numExitLevels = 0
| private

int IG.Lib.CommandStackFrameBase._loopCount = 0
| private

bool IG.Lib.CommandStackFrameBase._suppressInteractive = false
| private

string IG.Lib.CommandStackFrameBase._conditionExpression = null
| private

string IG.Lib.CommandStackFrameBase._blockCommandLine = null
| private

bool IG.Lib.CommandStackFrameBase._doSave = false
| private

List<string> IG.Lib.CommandStackFrameBase._commandLines = null
| private

string IG.Lib.CommandStackFrameBase._lastCommandLine = null
| private

SortedDictionary<string, InterpreterVariable> IG.Lib.CommandStackFrameBase._variables = new SortedDictionary<string, InterpreterVariable>()
| protected

Local variables.

string IG.Lib.CommandStackFrameBase._returnedValue = null
| private

List<string> IG.Lib.CommandStackFrameBase._auxVarNames = null
| protected

## Property Documentation

object IG.Lib.CommandStackFrameBase.Lock
| get

This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock.

int IG.Lib.CommandStackFrameBase.StackLevel
| get protected set

Referenced by IG.Lib.CommandThreadBase.RestorePreviousNumStoredParameters().

List<string> IG.Lib.CommandStackFrameBase.BlockEnterCommands
| get protected

A list of commands that can enter the type of the current code block.

List<string> IG.Lib.CommandStackFrameBase.BlockExitCommands
| get protected

A list of commands that can exit the type of the current code block.

List<string> IG.Lib.CommandStackFrameBase.BlockExitCommandsNoLevelEffect
| get protected

A list of commands that can exit the type of the current code block, but willl nnot have effect on the quet wxit/entry level.

Example is If/Else/Endif blocks. Both Else and Endif can exit the If block, but in quiet mode, only Endif should decrease the quiet entry/exit level (becauee only If increases it, and If always have the cottesponding EndIf).

int IG.Lib.CommandStackFrameBase.QuietBlockEntryLevel
| get protected set

Indicates the quiet entry/exit level of the current kind of block when commands are not executed.

The level is obtained by counting the block entry and block exit commands encountered (which were, nonetheless, not executed, because command execution is switched off)

CodeBlockType IG.Lib.CommandStackFrameBase.BlockType
| get protected set

Type of the code block represented by the current stack frame.

bool IG.Lib.CommandStackFrameBase.DoExecuteCommands
| get set

Whether commands are executed in the current code block.

bool IG.Lib.CommandStackFrameBase.WasBranchAlreadyExecuted
| get set

Whether a branch has already been executed.

int IG.Lib.CommandStackFrameBase.NumExitLevels
| get set

int IG.Lib.CommandStackFrameBase.LoopCount
| get set

Whether commands are executed in the current code block.

bool IG.Lib.CommandStackFrameBase.SuppressInteractive
| get set

Indicates that the interactive mode is temporarily represset.

string IG.Lib.CommandStackFrameBase.ConditionExpression
| get set

For loopig and branching blocks, this property contains the condition expression of the block, which was a part of the block command (such as While, If, or ElseIf).

string IG.Lib.CommandStackFrameBase.BlockCommanddLine
| get set

Commandline that started the current block. It may have been saved when the current block of code was entered, in order to be used within the block (e.g. for inspection and debugging) or when the block exits. Typical use is in blocks with deferred evaluation, such as in While block, where commandlines within the block are stored first, and then repeatedly evaluated until the condition from the While block entering command is fulfilled.

bool IG.Lib.CommandStackFrameBase.DoSaveCommands
| get set

Whether commands are saved to the command store in the current code block.

List<string> IG.Lib.CommandStackFrameBase.CommandLines
| get

string IG.Lib.CommandStackFrameBase.LastCommandLine
| get set

string IG.Lib.CommandStackFrameBase.ReturnedValue
| get set

Value returned from the last executed command.

string [] IG.Lib.CommandStackFrameBase.VariableNames
| get

Gets names of all variables that are defined on the current stack frame.

Operation is locked.

string [] IG.Lib.CommandStackFrameBase.VariableValueStrings
| get

Gets names of all variables that are defined on the current stack frame.

Operation is locked.

InterpreterVariable IG.Lib.CommandStackFrameBase.this[string variableName]
| get set

Gets or sets value of the variable with the specified name.

Parameters

  variableName | Name of the variable to be set or retrieved.

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

- igbase/interpreters/CommandlineApplicationInterpreterBase.cs