IGLib
1.7.2
The IGLib base library for development of numerical, technical and business applications.
|
Base class for classes of type CommandStackFrame{InterpreterType, ThreadType}see cref=""/>. Contains everyting that does not depend on specific type of generic parameters. More...
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 |
Base class for classes of type CommandStackFrame{InterpreterType, ThreadType}see cref=""/>. Contains everyting that does not depend on specific type of generic parameters.
|
inline |
|
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 >.
|
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 >.
|
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.
commands | Commands that are added to the list of commands that can enter the current kind of block. |
|
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.
commands | Commands that are added to the list of commands that can enter the current kind of block. |
|
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).
commands | Commands that are added to the list of commands that can enter the current kind of block. |
|
inline |
Returns the array of commands that can enter the current kind of code block.
|
inline |
Returns the array of commands that can exit the current kind of code block.
|
inline |
Returns the array of commands that can exit the current kind of code block but have no level effect.
|
inlineprotected |
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.
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().
|
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.
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). |
|
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.
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). |
|
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.
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). |
|
inline |
Inspects the specified commandline and checks whether it can represent a block enter or a block exit command for the currennt code block.
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.
|
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).
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. |
|
inline |
Returns true if the specified variable is defined, false if it is not.
varName | Name of the variable that is queried. |
|
inline |
Returns true if the specified variable is defined, false if it is not.
Thread safe variant, lock is aquired on Lock.
varName | Name of the variable that is queried. |
|
inline |
Returns variable object (definition) for the variable with specified name.
null is returned if the variable does not exist.
varName | Name of the variable. |
|
inline |
Returns value of the specified variable.
varName | Name of the variable. |
|
inline |
|
inline |
Sets value of the specified variable.
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.
|
inline |
Sets the variable within lock on the property.
Thread safe variant, lock is aquired on Lock.
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.
|
inline |
Removes the specified variable.
varName | Name of the variable to be removed. |
|
inline |
Removes the specified variable within lock on the property.
Thread safe variant, lock is aquired on Lock.
varName | Name of the variable whose value is to be set. |
|
inline |
Referenced by IG.Lib.CommandStackFrameBase.ToString().
|
inline |
Referenced by IG.Lib.CommandStackFrameBase.ToString().
|
inlinevirtual |
Returns a string containing information about the current command thread.
References IG.Lib.ICommandLineApplicationInterpreter.GlobalFrame, IG.Lib.CommandStackFrameBase.ToStringVariableNames(), and IG.Lib.CommandStackFrameBase.ToStringVariableValues().
|
inline |
Returns string representation of the current object.
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
Local variables.
|
private |
|
protected |
|
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.
|
getprotected set |
|
getprotected |
A list of commands that can enter the type of the current code block.
|
getprotected |
A list of commands that can exit the type of the current code block.
|
getprotected |
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).
|
getprotected 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)
|
getprotected set |
Type of the code block represented by the current stack frame.
|
getset |
Whether commands are executed in the current code block.
|
getset |
Whether a branch has already been executed.
|
getset |
|
getset |
Whether commands are executed in the current code block.
|
getset |
Indicates that the interactive mode is temporarily represset.
|
getset |
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).
|
getset |
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.
|
getset |
Whether commands are saved to the command store in the current code block.
|
get |
|
getset |
|
getset |
Value returned from the last executed command.
|
get |
Gets names of all variables that are defined on the current stack frame.
Operation is locked.
|
get |
Gets names of all variables that are defined on the current stack frame.
Operation is locked.
|
getset |
Gets or sets value of the variable with the specified name.
variableName | Name of the variable to be set or retrieved. |