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

Base class for main application classes that have the main method of the application based on command line interpreter. More...

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

Public Member Functions

 ApplicationCommandlineBase ()
 Constructor. More...
 
virtual void AddDefaultAssemblies ()
 Adds assemblies to be automatically referenced by loaded scripts. More...
 
abstract void TestMain (string[] args)
 Runs tests from scripts according to hard-coded settings. More...
 
virtual void AplicationMain (string[] args)
 Default main method for the current application. More...
 

Public Attributes

string OptDir
 Optimization directory that contains data and message files of optimization server. More...
 

Protected Member Functions

virtual void SetUserName (string userName)
 Sets name of the current user. This method is provided to enable testing code under another user name. Setting to null anihilates effect of previous calls. More...
 
abstract
CommandLineApplicationInterpreter 
CreateInterpreter ()
 Creates and returns application's command-line interpreter. More...
 
int GetScriptNumArguments ()
 Returns the number of script run method's arguments (i.e. arguments that are stored in DirectArguments and InterpreterArguments). If there are different numbers of More...
 
virtual void SetScriptNumArguments (int numArguments)
 Sets the number of script run method's arguments to the specified number. Reallocates argument arrays if necessary. More...
 
virtual void SetScriptArgument (int whichArgument, string argumentValue)
 Sets the specified script argument; updates array of arguments for running script directly as well as arguments for running script through interpreter. More...
 
virtual string GetScriptArgument (int whichArgument)
 Gets the specified string arguments, as it is currently set. More...
 

Protected Attributes

const string ConstScriptTests = "ScriptTests"
 Selecting constant fot TEST script. More...
 
const string ConstScriptCustomApp = "ScriptCustomApp"
 Selecting constant fot CUSTOM script. More...
 
const string ConstInteractive = "Interactive"
 Selecting constant for interactive run. More...
 
string ConstRunInteractive = "Interactive"
 Interpreter command for running in interactive mode. More...
 
string ConstRunScript = "RunScript"
 Interpreter command for running dynamic scripts. More...
 
string ScriptLocation = null
 Location of the script to be loaded. More...
 
string ScriptGroupChoice
 Main selector for script that is run. More...
 
string _scriptChoice
 
Type _scriptType
 
string ScriptAction
 Selector for script action. More...
 
string[] DirectArguments = null
 Script arguments used when script is run directly by creating a script object. More...
 
string[] InterpreterArguments = null
 Interpreter arguments used when script is run through interpreter. More...
 
string DefaultActiveDir
 Default active directory. The current directory will be set to this directory. More...
 
ILoadableScript _scriptToRun
 
bool RunThroughInterpreter = false
 Whether script is loaded and run through interpreter (alternative is direct construction of script class). More...
 
string _userNameLowerCase = null
 
CommandLineApplicationInterpreter TestInterpreter
 Application interpreter for running test scripts. More...
 

Properties

string ScriptChoice [get, set]
 Name of the selected script type that is run. More...
 
Type ScriptType [get, set]
 Selected type of the script to be run. More...
 
ILoadableScript ScriptToRun [get, set]
 Script to be run. More...
 
virtual string UserNameLowerCase [get]
 Gets name of the current user with all letters converted to lower case (in order to avoid ambiguities). More...
 
virtual bool IsUserIgor [get]
 Returns true if the current user logged on the computer is Igor, or false otherwise. More...
 
virtual bool IsUserTadej [get]
 Returns true if the current user logged on the computer is Tadej, or false otherwise. More...
 

Detailed Description

Base class for main application classes that have the main method of the application based on command line interpreter.

Dhis class represent the base for standard scheme for IGLib-based applications that include command-line interpreter and eventually a number of tests whose selection is hard-coded and which are performed when application command-line arguments are not specified.

$A Igor xx Nov09;

Constructor & Destructor Documentation

IG.Lib.ApplicationCommandlineBase.ApplicationCommandlineBase ( )
inline

Constructor.

Member Function Documentation

virtual void IG.Lib.ApplicationCommandlineBase.SetUserName ( string  userName)
inlineprotectedvirtual

Sets name of the current user. This method is provided to enable testing code under another user name. Setting to null anihilates effect of previous calls.

After call to this method, user name can be set to null in order to retrieve the true user logged in for subsequent operations.

Warning: you should use this only exceptionally, e.g. for testing, and only in testing or demo sections of code.

Parameters
userNameName of the user to be set. Null annihilates previous calls and causes that system provided user name is returned by subsequent queries.

References IG.Lib.UtilSystem.SetUsername().

virtual void IG.Lib.ApplicationCommandlineBase.AddDefaultAssemblies ( )
inlinevirtual

Adds assemblies to be automatically referenced by loaded scripts.

Reimplemented in IG.Lib.ShellApplication< InterpreterType >.

References IG.Lib.ScriptLoaderBase.AddDefaultAssemblies().

int IG.Lib.ApplicationCommandlineBase.GetScriptNumArguments ( )
inlineprotected

Returns the number of script run method's arguments (i.e. arguments that are stored in DirectArguments and InterpreterArguments). If there are different numbers of

virtual void IG.Lib.ApplicationCommandlineBase.SetScriptNumArguments ( int  numArguments)
inlineprotectedvirtual

Sets the number of script run method's arguments to the specified number. Reallocates argument arrays if necessary.

Number of arguments includes script run command and command selector for script's internal interpreter, i.e. this number is 2 greater than the number of pure arguments.

For arguments for running script through interpreter, actual number of arguments is 2 greater because it includes command for script loading/running + script location.

Parameters
numArguments
virtual void IG.Lib.ApplicationCommandlineBase.SetScriptArgument ( int  whichArgument,
string  argumentValue 
)
inlineprotectedvirtual

Sets the specified script argument; updates array of arguments for running script directly as well as arguments for running script through interpreter.

Parameters
whichArgumentIndex of argument in the array of arguments that is actually passed to the script (in the case of running through interpreter, this means without interpreter command for running dynamic scripts and without script location). The 0-th argument is typically (but not always) reserved for action selection.
argumentValueValue of the specified argument to be set.

$A Igor Nov09 Dec11;

virtual string IG.Lib.ApplicationCommandlineBase.GetScriptArgument ( int  whichArgument)
inlineprotectedvirtual

Gets the specified string arguments, as it is currently set.

Parameters
whichArgumentIndex of the obtained argument in the array of arguments to be passed to the script (in the case of running through interpreter, this means without interpreter command for running dynamic scripts and without script location). The 0-th argument is typically (but not always) reserved for action selection.
abstract void IG.Lib.ApplicationCommandlineBase.TestMain ( string[]  args)
pure virtual

Runs tests from scripts according to hard-coded settings.

Standard form of test applications for functionality based on IGLib.

Parameters
argsCommand-line argumets passed when the application is run.

Standard scheme for IGLib-based test applications has been adopted in December 2011.

$A Igor xx Nov09 Dec11;

Implemented in IG.Script.LoadableScriptShellNeuralBase.StoredScriptSettings, IG.Lib.LoadableScriptBase.StoredScriptSettings, IG.Lib.ShellApplication< InterpreterType >, IG.Script.LoadableScriptShellNeural.StoredScriptSettings, and IG.Lib.LoadableScriptShellBase.StoredScriptSettings.

virtual void IG.Lib.ApplicationCommandlineBase.AplicationMain ( string[]  args)
inlinevirtual

Default main method for the current application.

Parameters
argsCommand-line argumets passed when the application is run.

Standard scheme for IGLib-based test applications has been adopted in December 2011.

$A Igor xx Nov09 Dec11;

Reimplemented in IG.Lib.ShellApplication< InterpreterType >.

References IG.Lib.CommandLineApplicationInterpreter.MainThread, IG.Lib.CommandLineApplicationInterpreter.Run(), and IG.Lib.CommandLineApplicationInterpreter.WarnCommandReplacement.

Member Data Documentation

const string IG.Lib.ApplicationCommandlineBase.ConstScriptTests = "ScriptTests"
protected

Selecting constant fot TEST script.

Test scripts typically include several example methods, which can be selected by the first command-line argument.

const string IG.Lib.ApplicationCommandlineBase.ConstScriptCustomApp = "ScriptCustomApp"
protected

Selecting constant fot CUSTOM script.

const string IG.Lib.ApplicationCommandlineBase.ConstInteractive = "Interactive"
protected

Selecting constant for interactive run.

string IG.Lib.ApplicationCommandlineBase.ConstRunInteractive = "Interactive"
protected

Interpreter command for running in interactive mode.

string IG.Lib.ApplicationCommandlineBase.ConstRunScript = "RunScript"
protected

Interpreter command for running dynamic scripts.

string IG.Lib.ApplicationCommandlineBase.ScriptLocation = null
protected

Location of the script to be loaded.

string IG.Lib.ApplicationCommandlineBase.ScriptGroupChoice
protected

Main selector for script that is run.

string IG.Lib.ApplicationCommandlineBase._scriptChoice
protected
Type IG.Lib.ApplicationCommandlineBase._scriptType
protected
string IG.Lib.ApplicationCommandlineBase.ScriptAction
protected

Selector for script action.

string [] IG.Lib.ApplicationCommandlineBase.DirectArguments = null
protected

Script arguments used when script is run directly by creating a script object.

string [] IG.Lib.ApplicationCommandlineBase.InterpreterArguments = null
protected

Interpreter arguments used when script is run through interpreter.

string IG.Lib.ApplicationCommandlineBase.DefaultActiveDir
protected

Default active directory. The current directory will be set to this directory.

string IG.Lib.ApplicationCommandlineBase.OptDir

Optimization directory that contains data and message files of optimization server.

ILoadableScript IG.Lib.ApplicationCommandlineBase._scriptToRun
protected
bool IG.Lib.ApplicationCommandlineBase.RunThroughInterpreter = false
protected

Whether script is loaded and run through interpreter (alternative is direct construction of script class).

string IG.Lib.ApplicationCommandlineBase._userNameLowerCase = null
protected
CommandLineApplicationInterpreter IG.Lib.ApplicationCommandlineBase.TestInterpreter
protected

Application interpreter for running test scripts.

Property Documentation

string IG.Lib.ApplicationCommandlineBase.ScriptChoice
getsetprotected

Name of the selected script type that is run.

If ScriptType is defined then this property is defined in accordance with it.

Type IG.Lib.ApplicationCommandlineBase.ScriptType
getsetprotected

Selected type of the script to be run.

ILoadableScript IG.Lib.ApplicationCommandlineBase.ScriptToRun
getsetprotected

Script to be run.

virtual string IG.Lib.ApplicationCommandlineBase.UserNameLowerCase
get

Gets name of the current user with all letters converted to lower case (in order to avoid ambiguities).

virtual bool IG.Lib.ApplicationCommandlineBase.IsUserIgor
get

Returns true if the current user logged on the computer is Igor, or false otherwise.

virtual bool IG.Lib.ApplicationCommandlineBase.IsUserTadej
get

Returns true if the current user logged on the computer is Tadej, or false otherwise.


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