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.CommandThreadBase Class Referenceabstract

Base class for classes of type CommandThread{InterpreterType, FrameType, ThreadType}. Contains everything that is not dependent on generic frame and other parameters. More...

+ Inheritance diagram for IG.Lib.CommandThreadBase:
+ Collaboration diagram for IG.Lib.CommandThreadBase:

Public Member Functions

 CommandThreadBase ()
 
abstract
ICommandLineApplicationInterpreter 
GetInterpreterBase ()
 Returns the commans-line interpreter to which the current command thread belongs. More...
 
abstract CommandStackFrameBase GetStackFrameBase (int level)
 Returns the stack frame of the specified level for the current thread. More...
 
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...
 

Public Attributes

StopWatch1 _timer
 

Protected Member Functions

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

Static Protected Member Functions

static int GetNextIdThread ()
 Returns another ID that is unique for objects of the containing class its and derived classes. More...
 

Protected Attributes

int _outputLevel = DefaultOutputLevel
 Default level of output for some of the interpreters' functionality (e.g. asynchronous command execution). More...
 

Properties

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 Attributes

int _topFrameIndex = -1
 
object _mainLock = new object()
 
int _id = GetNextIdThread()
 
bool _wasCommandExecuted = false
 
bool _wasBlockEnterCommand = false
 
bool _wasBlockExitCommand = false
 
List< string > _storedPrompts = null
 
List< object > _parametersStore = null
 
List< int > _numParamsBeforeFrame = new List<int>()
 
int _lastNumStoredParameters = 0
 
int _indexOfLastNumStoredParameters = -1
 
bool _threadSuppressInteractive = false
 
bool _isOutputLevelSet = false
 

Static Private Attributes

static object _lockIdThread
 
static int _nextIdThread = 0
 

Detailed Description

Base class for classes of type CommandThread{InterpreterType, FrameType, ThreadType}. Contains everything that is not dependent on generic frame and other parameters.

Constructor & Destructor Documentation

IG.Lib.CommandThreadBase.CommandThreadBase ( )
inline

Member Function Documentation

abstract ICommandLineApplicationInterpreter IG.Lib.CommandThreadBase.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.CommandThread< InterpreterType, FrameType, ThreadType >.

abstract CommandStackFrameBase IG.Lib.CommandThreadBase.GetStackFrameBase ( int  level)
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.

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.

Implemented in IG.Lib.CommandThread< InterpreterType, FrameType, ThreadType >.

static int IG.Lib.CommandThreadBase.GetNextIdThread ( )
inlinestaticprotected

Returns another ID that is unique for objects of the containing class its and derived classes.

void IG.Lib.CommandThreadBase.StorePrompt ( string  prompt)
inline

Stores a string (prompt) to the end of the list of stored prompts.

Currently NOT USED!

Parameters
promptPrompt string to be stored.
string IG.Lib.CommandThreadBase.RestorePrompt ( )
inline

Restores a string (prompt) from the end of the list of stored prompts.

Currently NOT USED!

void IG.Lib.CommandThreadBase.PushParameter ( object  param)
inline

Stores a new parameter at the end of the parameter store.

WARNING: Users must make sure that PushParameter and PopParameter are properrly called in pairs, otherwise parameter store will ger corrupted and unusable for otherr users.

Parameters
paramParameter that is added to parameter store.
object IG.Lib.CommandThreadBase.PopParameter ( )
inline

Removae and returns the last object on the parameter store.

WARNING: Users must make sure that PushParameter and PopParameter are properrly called in pairs, otherwise parameter store will ger corrupted and unusable for otherr users.

This method must be called on the same top-level stack frame on which the PushParameter for the corresponding stored parameter was called.

object IG.Lib.CommandThreadBase.GetParameterFromTop ( int  whichPlaceFromTop = 0)
inline

Returns the stored parameter with the specified index from the top.

This method allows to access parameters that are owned by parent frames (because the PopParameter method can not access parameters that were not added by the current frame).

Parameters
whichPlaceFromTopSpecifies which stored parameter, in terms of the place from the top of the parameter stack downwards, should be obtained. Index 0 (default) specifies the last (top-most) parameter.
virtual void IG.Lib.CommandThreadBase.SaveNumStoredParameters ( )
inlineprotectedvirtual

Saves the current number of stored parameters on the command thread.

This must be called when a new stack frame is added.

If called at other places, it must be consistently called in pair with RestorePreviousNumStoredParameters.

virtual void IG.Lib.CommandThreadBase.RestorePreviousNumStoredParameters ( CommandStackFrameBase  frame)
inlineprotectedvirtual

Saves the current number of stored parameters on the command thread.

This must normally be called when a stack frame is removed.

If called at other places, it must be consistently called in pair with SaveNumStoredParameters.

References IG.Lib.CommandStackFrameBase.StackLevel.

override string IG.Lib.CommandThreadBase.ToString ( )
inline

Returns a string containing information about the current command thread.

References IG.Lib.ICommandLineApplicationInterpreter.GetCommmandThread(), and IG.Lib.ICommandLineApplicationInterpreter.NumCommandThreads.

Member Data Documentation

int IG.Lib.CommandThreadBase._topFrameIndex = -1
private
object IG.Lib.CommandThreadBase._mainLock = new object()
private
object IG.Lib.CommandThreadBase._lockIdThread
staticprivate
int IG.Lib.CommandThreadBase._nextIdThread = 0
staticprivate
int IG.Lib.CommandThreadBase._id = GetNextIdThread()
private
bool IG.Lib.CommandThreadBase._wasCommandExecuted = false
private
bool IG.Lib.CommandThreadBase._wasBlockEnterCommand = false
private
bool IG.Lib.CommandThreadBase._wasBlockExitCommand = false
private
List<string> IG.Lib.CommandThreadBase._storedPrompts = null
private
List<object> IG.Lib.CommandThreadBase._parametersStore = null
private
List<int> IG.Lib.CommandThreadBase._numParamsBeforeFrame = new List<int>()
private
int IG.Lib.CommandThreadBase._lastNumStoredParameters = 0
private
int IG.Lib.CommandThreadBase._indexOfLastNumStoredParameters = -1
private
bool IG.Lib.CommandThreadBase._threadSuppressInteractive = false
private
bool IG.Lib.CommandThreadBase._isOutputLevelSet = false
private
int IG.Lib.CommandThreadBase._outputLevel = DefaultOutputLevel
protected

Default level of output for some of the interpreters' functionality (e.g. asynchronous command execution).

StopWatch1 IG.Lib.CommandThreadBase._timer

Property Documentation

int IG.Lib.CommandThreadBase.TopFrameIndex
getprotected set
object IG.Lib.CommandThreadBase.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.

object IG.Lib.CommandThreadBase.LockIdThread
staticget

Lock used for acquiring IDs.

virtual int IG.Lib.CommandThreadBase.Id
get

Unique ID for objects of the currnet and derived classes.

bool IG.Lib.CommandThreadBase.WasCommandExecuted
getset

Auxiliary flag that indicates whether the last command launched on the current thread has actually been executed.

This flag is used for communication between the calling environment and the method that takes care of final invocation of commands.

bool IG.Lib.CommandThreadBase.WasBlockEnterCommand
getset

Auxiliary flag that indicates whether the last executed command was a block enter command.

This flag is cleared when WasCommandExecuted is cleared, and is set by block entering commands themselves.

bool IG.Lib.CommandThreadBase.WasBlockExitCommand
getset

Auxiliary flag that indicates whether the last executed command was a block exit command.

This flag is cleared when WasCommandExecuted is cleared, and is set by block exiting commands themselves.

List<String> IG.Lib.CommandThreadBase.StoredPrompts
getprivate

Auxiliary list where calling environment can store prompts used e.g. in interactive mode

Currently NOT USED!

List<object> IG.Lib.CommandThreadBase.ParameterStore
getprivate

Stored objects.

int IG.Lib.CommandThreadBase.NumStoredParameters
get
bool IG.Lib.CommandThreadBase.SuppressInteractive
getset

Indicates that the interactive mode is temporarily represset.

int IG.Lib.CommandThreadBase.DefaultOutputLevel
staticgetset
bool IG.Lib.CommandThreadBase.IsOutputLevelSet
getprotected set
virtual int IG.Lib.CommandThreadBase.OutputLevel
getset

Level of output for some of the interpreter's functionality (e.g. asynchronous command execution).

StopWatch1 IG.Lib.CommandThreadBase.Timer
get

Gets the stopwatch used for measuring time of commands.

This property always returns an initialized stopwatch.


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