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.LoadableScriptInterpreterBase Class Reference

Interpreter that can install commands from dynamically loaded (compiled) scripts and run them. Script loader object of a type is accessed through a property that can be overridden in derived classes, such that a different script loader is used. This is importand because different libraries will be required for compilation in different contexts. Script loader property creates a new script loader on first access. More...

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

Public Member Functions

 LoadableScriptInterpreterBase ()
 
string RunCommand (string commandName, string[] commandArguments)
 Runs command with the specified name that is loaded on the current object. More...
 
void AddCommandFromCode (string commandName, string code, string className, string[] initializationArguments)
 Adds a new command whose execution is perfomed by an instance of a class that is dynamically compiled from the specified script code. More...
 
void AddCommandFromCode (string commandName, string code, string[] initializationArguments)
 Adds a new command whose execution is perfomed by an instance of a class that is dynamically compiled from the specified script code. Name of the class is extracted from the script code. More...
 
void AddCommandFromFile (string commandName, string filePath, string className, string[] initializationArguments)
 Adds a new command whose execution is perfomed by an instance of a class that is dynamically compiled from the script code contained in the specified file. More...
 
void AddCommandFromFile (string commandName, string filePath, string[] initializationArguments)
 Adds a new command whose execution is perfomed by an instance of a class that is dynamically compiled from the script code contained in the specified file. Name of the class is extracted from the script code. More...
 

Protected Attributes

ScriptLoaderBase _scriptLoader
 

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...
 
virtual ScriptLoaderBase ScriptLoader [get, set]
 Script loader that is used to load loadable script classes that will be used for execution of commands. More...
 
SortedList< string,
ILoadableScript
Commands [get]
 Sorted list that contains commands as key-value pairs where the key is command name and the corresponding value is a loadable script object of type that can be executd. More...
 
ILoadableScript this[string commandName] [get, set]
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 

Private Attributes

object _mainLock = new object()
 
SortedList< string,
ILoadableScript
_commands = new SortedList<string, ILoadableScript>()
 

Detailed Description

Interpreter that can install commands from dynamically loaded (compiled) scripts and run them. Script loader object of a type is accessed through a property that can be overridden in derived classes, such that a different script loader is used. This is importand because different libraries will be required for compilation in different contexts. Script loader property creates a new script loader on first access.

$A Igor Oct09;

Constructor & Destructor Documentation

IG.Lib.LoadableScriptInterpreterBase.LoadableScriptInterpreterBase ( )
inline

Member Function Documentation

string IG.Lib.LoadableScriptInterpreterBase.RunCommand ( string  commandName,
string[]  commandArguments 
)
inline

Runs command with the specified name that is loaded on the current object.

Parameters
commandNameName of the command.
commandArgumentsCommand arguments.
Returns
Result of the command.

References IG.Lib.ILoadableScript.Run().

void IG.Lib.LoadableScriptInterpreterBase.AddCommandFromCode ( string  commandName,
string  code,
string  className,
string[]  initializationArguments 
)
inline

Adds a new command whose execution is perfomed by an instance of a class that is dynamically compiled from the specified script code.

Parameters
commandNameInterpreter's name of the command; added command is installed under this name on the current interpreter.
codeScript code containing definition of the loadable class that contains executable code of the command.
classNameName of the class containing loadable script code.
initializationArgumentsInitialization arguments for the created object that will perform execution of the added command.
void IG.Lib.LoadableScriptInterpreterBase.AddCommandFromCode ( string  commandName,
string  code,
string[]  initializationArguments 
)
inline

Adds a new command whose execution is perfomed by an instance of a class that is dynamically compiled from the specified script code. Name of the class is extracted from the script code.

Parameters
commandNameInterpreter's name of the command; added command is installed under this name on the current interpreter.
codeScript code containing definition of the loadable class that contains executable code of the command.
initializationArgumentsInitialization arguments for the created object that will perform execution of the added command.
void IG.Lib.LoadableScriptInterpreterBase.AddCommandFromFile ( string  commandName,
string  filePath,
string  className,
string[]  initializationArguments 
)
inline

Adds a new command whose execution is perfomed by an instance of a class that is dynamically compiled from the script code contained in the specified file.

Parameters
commandNameInterpreter's name of the command; added command is installed under this name on the current interpreter.
filePathPath to the file containing script code containing definition of the loadable class that contains executable code of the command.
classNameName of the class containing loadable script code.
initializationArgumentsInitialization arguments for the created object that will perform execution of the added command.
void IG.Lib.LoadableScriptInterpreterBase.AddCommandFromFile ( string  commandName,
string  filePath,
string[]  initializationArguments 
)
inline

Adds a new command whose execution is perfomed by an instance of a class that is dynamically compiled from the script code contained in the specified file. Name of the class is extracted from the script code.

Parameters
commandNameInterpreter's name of the command; added command is installed under this name on the current interpreter.
filePathPath to the file containing script code containing definition of the loadable class that contains executable code of the command.
initializationArgumentsInitialization arguments for the created object that will perform execution of the added command.

Member Data Documentation

object IG.Lib.LoadableScriptInterpreterBase._mainLock = new object()
private
ScriptLoaderBase IG.Lib.LoadableScriptInterpreterBase._scriptLoader
protected
SortedList<string, ILoadableScript> IG.Lib.LoadableScriptInterpreterBase._commands = new SortedList<string, ILoadableScript>()
private

Property Documentation

object IG.Lib.LoadableScriptInterpreterBase.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.

virtual ScriptLoaderBase IG.Lib.LoadableScriptInterpreterBase.ScriptLoader
getset

Script loader that is used to load loadable script classes that will be used for execution of commands.

SortedList<string, ILoadableScript> IG.Lib.LoadableScriptInterpreterBase.Commands
get

Sorted list that contains commands as key-value pairs where the key is command name and the corresponding value is a loadable script object of type that can be executd.

ILoadableScript IG.Lib.LoadableScriptInterpreterBase.this[string commandName]
getset

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