IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType > Class Template Referenceabstract

Contains stack frames and other command thread data for a single command thread of a command-line interreter. More...

+ Inheritance diagram for IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >:
+ Collaboration diagram for IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >:

Public Member Functions

 CommandThread (InterpreterType interpreter)
 
override
ICommandLineApplicationInterpreter 
GetInterpreterBase ()
 Returns the commans-line interpreter to which the current command thread belongs. More...
 
override CommandStackFrameBase GetStackFrameBase (int level)
 Returns the stack frame of the specified level for the current thread. More...
 
FrameType AddFrame (CodeBlockType blockType)
 Adds a new stack frame. More...
 
FrameType RemoveFrame ()
 Removes the last stack frame. More...
 
- Public Member Functions inherited from IG.Lib.CommandThreadBase
 CommandThreadBase ()
 
void StorePrompt (string prompt)
 Stores a string (prompt) to the end of the list of stored prompts. More...
 
string RestorePrompt ()
 Restores a string (prompt) from the end of the list of stored prompts. More...
 
void PushParameter (object param)
 Stores a new parameter at the end of the parameter store. More...
 
object PopParameter ()
 Removae and returns the last object on the parameter store. More...
 
object GetParameterFromTop (int whichPlaceFromTop=0)
 Returns the stored parameter with the specified index from the top. More...
 
override string ToString ()
 Returns a string containing information about the current command thread. More...
 

Protected Member Functions

abstract FrameType CreateFrame (CodeBlockType type, int stackLevel)
 
- Protected Member Functions inherited from IG.Lib.CommandThreadBase
virtual void SaveNumStoredParameters ()
 Saves the current number of stored parameters on the command thread. More...
 
virtual void RestorePreviousNumStoredParameters (CommandStackFrameBase frame)
 Saves the current number of stored parameters on the command thread. More...
 

Properties

InterpreterType Interpreter [get, protected set]
 Returns interpreter that handles command execution on the current command thread. More...
 
List< FrameType > StackFrames [get]
 A list of stack frames existent in the current thread. More...
 
FrameType BaseFrame [get, protected set]
 Base stack frame, created when the thread is initialized and exists until thread is exited. More...
 
FrameType TopFrame [get, protected set]
 Base stack frame, created when the thread is initialized and exists until thread is exited. More...
 
FrameType this[int which] [get]
 
- Properties inherited from IG.Lib.CommandThreadBase
int TopFrameIndex [get, protected set]
 
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...
 
static object LockIdThread [get]
 Lock used for acquiring IDs. More...
 
virtual int Id [get]
 Unique ID for objects of the currnet and derived classes. More...
 
bool WasCommandExecuted [get, set]
 Auxiliary flag that indicates whether the last command launched on the current thread has actually been executed. More...
 
bool WasBlockEnterCommand [get, set]
 Auxiliary flag that indicates whether the last executed command was a block enter command. More...
 
bool WasBlockExitCommand [get, set]
 Auxiliary flag that indicates whether the last executed command was a block exit command. More...
 
List< String > StoredPrompts [get]
 Auxiliary list where calling environment can store prompts used e.g. in interactive mode More...
 
List< object > ParameterStore [get]
 Stored objects. More...
 
int NumStoredParameters [get]
 
bool SuppressInteractive [get, set]
 Indicates that the interactive mode is temporarily represset. More...
 
static int DefaultOutputLevel [get, set]
 
bool IsOutputLevelSet [get, protected set]
 
virtual int OutputLevel [get, set]
 Level of output for some of the interpreter's functionality (e.g. asynchronous command execution). More...
 
StopWatch1 Timer [get]
 Gets the stopwatch used for measuring time of commands. More...
 
- Properties inherited from IG.Lib.IIdentifiable
int Id [get]
 Returns unique ID (in the scope of a given type) of the current object. More...
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 

Private Member Functions

 CommandThread ()
 

Private Attributes

InterpreterType _interpreter
 
List< FrameType > _stackFrames = new List<FrameType>()
 
FrameType _baseFrame = null
 
FrameType _topFrame = null
 

Additional Inherited Members

- Public Attributes inherited from IG.Lib.CommandThreadBase
StopWatch1 _timer
 
- Static Protected Member Functions inherited from IG.Lib.CommandThreadBase
static int GetNextIdThread ()
 Returns another ID that is unique for objects of the containing class its and derived classes. More...
 
- Protected Attributes inherited from IG.Lib.CommandThreadBase
int _outputLevel = DefaultOutputLevel
 Default level of output for some of the interpreters' functionality (e.g. asynchronous command execution). More...
 

Detailed Description

Contains stack frames and other command thread data for a single command thread of a command-line interreter.

Usually properties, index operators and methods are not thread safe. Variants whose names end with "Locked" implement locking on the CommandThreadBase.Lock property and are thus thread safe. It is not likely that locking is needed because the object will typically be used within a single thread.

Template Parameters
InterpreterTypeType of the interpreter for which this class provides command thread data.
FrameTypeType of stack frames that is combined with this type.
ThreadTypeType of command thread data - represents this very type, to make it easier to use the frame type (which, in turn, has a type parameter for thread type).

$A Igor Sep15;

Type Constraints
InterpreterType :class 
InterpreterType :ICommandLineApplicationInterpreter 
FrameType :CommandStackFrame 
FrameType :InterpreterType 
FrameType :ThreadType 
ThreadType :CommandThread 
ThreadType :InterpreterType 
ThreadType :FrameType 
ThreadType :ThreadType 

Constructor & Destructor Documentation

IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.CommandThread ( )
inlineprivate
IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.CommandThread ( InterpreterType  interpreter)
inline

Member Function Documentation

override ICommandLineApplicationInterpreter IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.GetInterpreterBase ( )
inlinevirtual

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.

Implements IG.Lib.CommandThreadBase.

override CommandStackFrameBase IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.GetStackFrameBase ( int  level)
inlinevirtual

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.

Parameters
levelLevel of the stack frame to be returned.

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.

Implements IG.Lib.CommandThreadBase.

abstract FrameType IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.CreateFrame ( CodeBlockType  type,
int  stackLevel 
)
protectedpure virtual
FrameType IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.AddFrame ( CodeBlockType  blockType)
inline

Adds a new stack frame.

Parameters
blockTypeType of the code block represented by the stack frame.
Returns
Stack frame that has been added.
FrameType IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.RemoveFrame ( )
inline

Removes the last stack frame.

Returns
The stack frame that has been removed, so it can be used for inspection.

Member Data Documentation

InterpreterType IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >._interpreter
private
List<FrameType> IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >._stackFrames = new List<FrameType>()
private
FrameType IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >._baseFrame = null
private
FrameType IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >._topFrame = null
private

Property Documentation

InterpreterType IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.Interpreter
getprotected set

Returns interpreter that handles command execution on the current command thread.

List<FrameType> IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.StackFrames
getprotected

A list of stack frames existent in the current thread.

FrameType IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.BaseFrame
getprotected set

Base stack frame, created when the thread is initialized and exists until thread is exited.

FrameType IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.TopFrame
getprotected set

Base stack frame, created when the thread is initialized and exists until thread is exited.

FrameType IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.this[int which]
get

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