IGLib
1.7.2
The IGLib base library for development of numerical, technical and business applications.
|
Base class for classes that can be dynamically loadeded from scripts and run, which provides functionality of dynamic scripting. It is recommendable to derive all such classes that implement the ILoadableScript interface from this base class. More...
Classes | |
class | Script_CommandAdapter |
Adapts that converts internal script commands (delegate of type Script_CommandDelegate) to interpreter commands. More... | |
class | StoredScriptSettings |
In methods of this class you will find all the settings that apply to this script. More... | |
Public Member Functions | |
LoadableScriptBase () | |
Argument-less constructor. If argument-less constructor is called then initialization is not performed and will be performed later. More... | |
string | Run (string[] arguments) |
Performs the action of this object. Override this in derived classes! More... | |
void | Initialize (string[] arguments) |
Initializes the object. If not called explicitly, this method is automatically called at the first call to the Run method. More... | |
virtual string | Script_DefaultInitialize (string[] arguments) |
Default initialization method for scripts. More... | |
virtual string | Script_DefaultRun (string[] arguments) |
Default run method for the script. Can be used when only installed commands are run by hte script. More... | |
virtual ICommandLineApplicationInterpreter | Script_CreateInterpreterWithoutCommands () |
Creates and returns an interpreter that can be used as script's internal interpreter for running script's commands. More... | |
virtual void | Script_AddCommands (ICommandLineApplicationInterpreter interpreter, SortedList< string, string > helpStrings) |
Add wscript's internal commands to the specified interpreter. More... | |
delegate string | Script_CommandDelegate (string[] args) |
Delegate for commands that are installed on script's internal interpreter (property Script_Interpreter). More... | |
void | Script_AddCommand (string commandName, Script_CommandDelegate command, string helpString) |
Adds a new internal script command under specified name to the internal interpreter of the current script object. More... | |
virtual void | Script_AddCommand (ICommandLineApplicationInterpreter interpreter, SortedList< string, string > helpStrings, string commandName, Script_CommandDelegate command, string helpString) |
Adds a new internal script command under specified name to the internal interpreter of the current script object. More... | |
string | Script_GetHelpString (string scriptCommandName) |
Returns help string for internal script command with specified name, or null if help string is not installed for such a command. More... | |
void | Script_PrintCommandsHelp () |
Prits help for the installed internal commands of the script. More... | |
virtual bool | Script_ContainsCommand (string commandName) |
Returns true if the internal script's interpreter contains a command with specified name, false otherwise. More... | |
virtual bool | Script_ContainsScriptCommand (string commandName) |
Returns true if the specified command is script command (i.e. its first argument is command-name and it is run through the Script_CommandAdapter object). More... | |
virtual void | Script_RemoveCommand (string commandName) |
Removes the specified internal script command from the internal interpreter of the current scripting object. More... | |
virtual void | Script_RemoveAllCommands () |
Removes ALL internal script commands from the internal interpreter of the current scripting object. More... | |
string | Script_Run (string[] arguments) |
Runs internal script command. More... | |
string | Script_Run (string commandName, params string[] otherArguments) |
Runs internal script command. More... | |
virtual void | Script_PrintArguments (string messageString, string[] arguments) |
Prints the specified array of string arguments (usually passed as command-line arguments). More... | |
Public Attributes | |
const string | ConstDefaultHelp = "Help" |
Default command name for help. More... | |
const string | ConstHelpDefaultUniversal = "?" |
Universal name of the help command. More... | |
const string | ConstDefaultTestScrip = "TestScript" |
Default command name for test method. More... | |
Protected Member Functions | |
delegate string | CommandMethod (string commandName, string[] args) |
Delegate for internal command methods. More... | |
abstract string | RunThis (string[] arguments) |
Performs the action of this object. Override this in derived classes! More... | |
abstract void | InitializeThis (string[] arguments) |
Performs all the necessary initializations of the object. Override this method in derived classes (if extra initialization is needed) and call the base class' method in it. More... | |
ICommandLineApplicationInterpreter | Script_CreateInterpreter () |
Creates and returns an interpreter that can be used as script's internal interpreter for running script's commands. More... | |
virtual string | Script_CommandHelp (string[] arguments) |
Prints help. More... | |
virtual string | Script_CommandTestScript (string[] arguments) |
Prints help. More... | |
Protected Attributes | |
string | _embeddedCommandName = null |
int | _outputLevel = DefaultOutputLevel |
ICommandLineApplicationInterpreter | _script_interpreter |
Properties | |
string | EmbeddedCommandName [get, set] |
Command that was used to launch the current embedded application script. More... | |
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... | |
string[] | InitializationArguments [get, set] |
Arguments used by the initialization method. WARNING: arguments can only be set before initialization is performed. Initialization is performed either implicitly at the first call to the Run method or explicitly by calling the Initialize method. More... | |
virtual bool | IsInitialized [get, protected set] |
Whether the object has been initialized or not. More... | |
static int | DefaultOutputLevel [get, set] |
int | OutputLevel [get, set] |
Level of output to console produced by some operations of the current object. More... | |
virtual ICommandLineApplicationInterpreter | Script_Interpreter [get, protected set] |
Script's internal interpreter that takes care for execution of installed internal commands. More... | |
SortedList< string, string > | Script_CommandHelpStrings [get] |
Contains help strings associated with script commands installed on interpreter. More... | |
Properties inherited from IG.Lib.ILoadableScript | |
string | EmbeddedCommandName [get, set] |
Command that was used to launch the current embedded application script. More... | |
string[] | InitializationArguments [get, set] |
Arguments used by the initialization method. More... | |
bool | IsInitialized [get] |
Whether the object has been initialized or not. More... | |
Properties inherited from IG.Lib.ILockable | |
object | Lock [get] |
Private Attributes | |
object | _mainLock = new object() |
string[] | _initializationArguments |
bool | _isInitialized = false |
SortedList< string, string > | _script_CommandHelpStrings |
Static Private Attributes | |
static int | _defaultOutputLevel = -1 |
Base class for classes that can be dynamically loadeded from scripts and run, which provides functionality of dynamic scripting. It is recommendable to derive all such classes that implement the ILoadableScript interface from this base class.
Initialization of objects of this class can be performed by the Initialize method. If not performed explicitly, initialization is perform automatically at the first call to teh Run() method.
$A Igor Jul09 May10;
|
inline |
Argument-less constructor. If argument-less constructor is called then initialization is not performed and will be performed later.
|
protected |
Delegate for internal command methods.
commandName | Name of the internal command. |
args | Arguments to the command. |
|
protectedpure virtual |
Performs the action of this object. Override this in derived classes!
arguments | Arguments through which different information can be passed. |
Implemented in IG.Script.LoadableScriptSpecialFunctionBase, IG.Lib.LoadableScriptOptTest.LoadableScriptOptDerived, IG.Script.ScriptAppBase, IG.Script.LoadableScriptExample, IG.Script.LoadableScriptShellNeural, IG.Lib.LoadableScriptRealFunctionBase, IG.Script.ScriptGraphics3DBase, IG.Lib.LoadableScriptScalarFunctionBase, IG.Script.ScriptGraphics2dBase, and IG.Script.TestIglibExt_ToDelete.
|
protectedpure virtual |
Performs all the necessary initializations of the object. Override this method in derived classes (if extra initialization is needed) and call the base class' method in it.
Implemented in IG.Script.LoadableScriptSpecialFunctionBase, IG.Lib.LoadableScriptOptTest.LoadableScriptOptDerived, IG.Script.ScriptAppBase, IG.Lib.LoadableScriptOptShellBaseControllable, IG.Script.LoadableScriptExample, IG.Lib.LoadableScriptRealFunctionBase, IG.Script.LoadableScriptShellNeural, IG.Script.LoadableScriptShellNeuralBase, IG.Lib.LoadableScriptShellBase, IG.Lib.LoadableScriptOptBase, IG.Lib.LoadableScriptScalarFunctionBase, IG.Script.ScriptGraphics3DBase, IG.Script.ScriptGraphics2dBase, and IG.Script.TestIglibExt_ToDelete.
|
inline |
Performs the action of this object. Override this in derived classes!
arguments | Arguments through which different information can be passed. |
Implements IG.Lib.ILoadableScript.
|
inline |
Initializes the object. If not called explicitly, this method is automatically called at the first call to the Run method.
Implements IG.Lib.ILoadableScript.
|
inlinevirtual |
Default initialization method for scripts.
arguments | Initialization arguments. |
|
inlinevirtual |
Default run method for the script. Can be used when only installed commands are run by hte script.
arguments | Command arguments. The first argument must be name of the command that is run. |
|
inlinevirtual |
Creates and returns an interpreter that can be used as script's internal interpreter for running script's commands.
Commands installed on this interpreter recieve the same command arguments as the Run command.
References IG.Lib.CommandLineApplicationScriptInterpreter.Script_CommandHelpStrings, and IG.Lib.CommandLineApplicationInterpreter.WarnCommandReplacement.
|
inlineprotected |
Creates and returns an interpreter that can be used as script's internal interpreter for running script's commands.
Script's internal commands are added by the Script_AddCommands method before the created interpreter is returned.
In order to create another interpreter, override the Script_CreateInterpreterWithoutCommands method. In order to add another set of script internal commands, override the Script_AddCommands method.
Commands installed on this interpreter recieve the same command arguments as the Run command.
|
inlinevirtual |
Add wscript's internal commands to the specified interpreter.
interpreter | Interpreter to which commands are added. |
helpStrings | List where help strings for corresponding commands are stored (optional). |
Reimplemented in IG.Script.LoadableScriptSpecialFunctionBase, IG.Script.LoadableScriptShellNeuralBase, IG.Script.ScriptAppBase, IG.Script.ScriptGraphics3DBase, IG.Script.ScriptGraphics2dBase, IG.Script.AppBase, and IG.Script.AppExtBase.
|
inlineprotectedvirtual |
Prints help.
arguments | Arguments. |
|
inlineprotectedvirtual |
Prints help.
arguments | Arguments. |
delegate string IG.Lib.LoadableScriptBase.Script_CommandDelegate | ( | string[] | args | ) |
Delegate for commands that are installed on script's internal interpreter (property Script_Interpreter).
These methods only take command arguments as parameters, and the first argument is usually name under which command is installed.
args | Command arguments. The first argument is internal script's command name. |
|
inline |
Adds a new internal script command under specified name to the internal interpreter of the current script object.
commandName | Name of the command. |
Must not be null or empty string.
command | Method that executes the command. |
Must not be null.
helpString | Help string associated with command, optionsl (can be null). |
|
inlinevirtual |
Adds a new internal script command under specified name to the internal interpreter of the current script object.
interpreter | Interpreter on which the command is added. |
helpStrings | Dictionary containing help strings corresponding to interpreter commands. |
commandName | Name of the command. |
Must not be null or empty string.
command | Method that executes the command. |
Must not be null.
helpString | Help string associated with command, optionsl (can be null). |
Reimplemented in IG.Script.LoadableScriptSpecialFunctionBase.
References IG.Lib.ICommandLineApplicationInterpreter.AddCommand(), IG.Lib.ICommandLineApplicationInterpreter.ContainsCommand(), IG.Lib.LoadableScriptBase.Script_CommandAdapter.InterpreterCommand(), and IG.Lib.ICommandLineApplicationInterpreter.RemoveCommand().
|
inline |
Returns help string for internal script command with specified name, or null if help string is not installed for such a command.
scriptCommandName | Name of the csript command. |
Referenced by IG.Lib.LoadableScriptBase.Script_CommandAdapter.InterpreterCommand().
|
inline |
Prits help for the installed internal commands of the script.
|
inlinevirtual |
Returns true if the internal script's interpreter contains a command with specified name, false otherwise.
commandName | Name of the command whose existence is queried. |
|
inlinevirtual |
Returns true if the specified command is script command (i.e. its first argument is command-name and it is run through the Script_CommandAdapter object).
commandName | Name of the command that is queried. |
|
inlinevirtual |
Removes the specified internal script command from the internal interpreter of the current scripting object.
commandName | Name of the command. |
Must not be null or empty string.
|
inlinevirtual |
Removes ALL internal script commands from the internal interpreter of the current scripting object.
References IG.Lib.ICommandLineApplicationInterpreter.RemoveAllCommands().
|
inline |
Runs internal script command.
arguments | Arguments of the command. The first argument must be command name. |
ArgumentException | When argumens or command are not specified or command is not known. |
|
inline |
Runs internal script command.
commandName | Name of the command |
otherArguments | The remainind command arguments (without a name). |
Name is prepended to arguments before the script is run.
ArgumentException | When argumens or command are not specified or command is not known. |
|
inlinevirtual |
Prints the specified array of string arguments (usually passed as command-line arguments).
arguments | Arguments to be printed. |
messageString | Message to be printed first (optional, can be null). |
|
protected |
|
private |
|
private |
|
private |
|
staticprivate |
|
protected |
const string IG.Lib.LoadableScriptBase.ConstDefaultHelp = "Help" |
Default command name for help.
const string IG.Lib.LoadableScriptBase.ConstHelpDefaultUniversal = "?" |
Universal name of the help command.
const string IG.Lib.LoadableScriptBase.ConstDefaultTestScrip = "TestScript" |
Default command name for test method.
|
protected |
|
private |
|
getset |
Command that was used to launch the current embedded application script.
|
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.
|
getset |
Arguments used by the initialization method. WARNING: arguments can only be set before initialization is performed. Initialization is performed either implicitly at the first call to the Run method or explicitly by calling the Initialize method.
|
getprotected set |
Whether the object has been initialized or not.
|
staticgetset |
Referenced by IG.Lib.ShellApplication< InterpreterType >.TestMain().
|
getset |
Level of output to console produced by some operations of the current object.
|
getprotected set |
Script's internal interpreter that takes care for execution of installed internal commands.
This interpreter is created when first needed (lazy evaluation).
Although this property is market virtual, you will normally not need to override it. Instead, override the Script_CreateInterpreter method, whch should do all the initializations of the interpreter.
|
getprotected |
Contains help strings associated with script commands installed on interpreter.