| IGLib 1.6.0 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
Public Member Functions | Protected Member Functions | Protected Attributes | Properties | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
IG.Lib.CommandLine Class Referenceabstract

Represents a single command-line that can be executed. $A Igor Feb09; More...

Inheritance diagram for IG.Lib.CommandLine:
[legend]
Collaboration diagram for IG.Lib.CommandLine:
[legend]

## Public Member Functions
| CommandLine ()
| Creates a new command that can be used in command-line interpreters. More...
void | Register ()
| Registers the current object. Subsequent calls (after the first one) have no effect. More...
bool | IsRegistered ()
| Returns true if the current object is registered, false if not. More...
void | Unregister ()
| Unregisters the current object if it is currently registered. Can be performed several times, in this case only the first call may have effect. More...
void | AddCommandReference (int interpreterId, string commandName, string description)
| Adds a new command use reference for this command. This method should be called whenever the command in installed on some interpreter. An internal list is used to store all references to this command on various interpreters. Stored references are unique (i.e. pairs {InterpreterId, CommandName}). More...
void | RemoveCommandReference (int interpreterId, string commandName)
| Removes command uage reference. This method should be called whenever a command is uninstalled form interpreter. More...
abstract void | Dispose ()
| Clean up after the reference is not used any more. More...

## Protected Member Functions
abstract void | Execute (CommandLineInterpreter interpreter, string command, string[] arguments)
| Executes the current command. Warning: whenever the data on command object (i.e. this) or interpreter object is accessed, these objects must be locked! If such data is not accessed then locking is not necessary. More...

## Protected Attributes
string | _command
| Temporary storage of command name for execution in a new thread. More...
string[] | _arguments
| Temporary storage of command arguments for execution in a new thread. More...
bool | _threadStarted
| Flag used to signal that command data has been picked by the executing thread and so object access can be unlocked. More...

## 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 int | Id`[get]`
| Returns unique Id (in the scope of a given type) of the current object. Method is defined as virtual so that derived class can have its own IDs by defining its own static IdentifiableGenerator object. More...
ObjectRegister< CommandLine > | ObjectRegister`[get]`
| Gets object register where the current object is registered. More...
Properties inherited from IG.Lib.ILockable
object | Lock`[get]`
Properties inherited from IG.Lib.IRegisterable< T >
ObjectRegister< T > | ObjectRegister`[get]`
| Gets the object register where the current object can be registered. 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...

## Private Member Functions
| ~CommandLine ()

## Private Attributes
object | _mainLock = new object()
IdProxy | _idPproxy
| Proxy object that implements the IIdentifiable interface for this object. More...
SortedDictionary < CommandUseReference, string > | _commandReferences

## Static Private Attributes
static ObjectRegister < CommandLine > | _register
| Static object that providees object register and generates IDs for this class: More...

## Detailed Description

Represents a single command-line that can be executed. $A Igor Feb09;

## Constructor & Destructor Documentation

IG.Lib.CommandLine.CommandLine | ( |  | ) |
| inline

Creates a new command that can be used in command-line interpreters.

IG.Lib.CommandLine.~CommandLine | ( |  | ) |
| inline private

## Member Function Documentation

void IG.Lib.CommandLine.Register | ( |  | ) |
| inline

Registers the current object. Subsequent calls (after the first one) have no effect.

Implements IG.Lib.IRegisterable< T >.

bool IG.Lib.CommandLine.IsRegistered | ( |  | ) |
| inline

Returns true if the current object is registered, false if not.

Returns

Implements IG.Lib.IRegisterable< T >.

void IG.Lib.CommandLine.Unregister | ( |  | ) |
| inline

Unregisters the current object if it is currently registered. Can be performed several times, in this case only the first call may have effect.

Implements IG.Lib.IRegisterable< T >.

void IG.Lib.CommandLine.AddCommandReference | ( | int | interpreterId,
|  | string | commandName,
|  | string | description
| ) |  |
| inline

Adds a new command use reference for this command. This method should be called whenever the command in installed on some interpreter. An internal list is used to store all references to this command on various interpreters. Stored references are unique (i.e. pairs {InterpreterId, CommandName}).

Parameters

  interpreterId | ID of the interpreter where command is installed.
  commandName | Command name under which the command is installed on this interpreter.
  description | Custom description of the specified reference, can be null.

Referenced by IG.Lib.CommandLineInterpreter.AddCommand().

void IG.Lib.CommandLine.RemoveCommandReference | ( | int | interpreterId,
|  | string | commandName
| ) |  |
| inline

Removes command uage reference. This method should be called whenever a command is uninstalled form interpreter.

Referenced by IG.Lib.CommandLineInterpreter.RemoveCommand().

abstract void IG.Lib.CommandLine.Execute | ( | CommandLineInterpreter | interpreter,
|  | string | command,
|  | string[] | arguments
| ) |  |
| protected pure virtual

Executes the current command. Warning: whenever the data on command object (i.e. this) or interpreter object is accessed, these objects must be locked! If such data is not accessed then locking is not necessary.

Parameters

  interpreter | Interpreter that executed the command.
  command | Command name under which the command is executed. A single command instance can be installed under several names on the interpreter.
  arguments | Arguments of the command.

abstract void IG.Lib.CommandLine.Dispose | ( |  | ) |
| pure virtual

Clean up after the reference is not used any more.

## Member Data Documentation

object IG.Lib.CommandLine._mainLock = new object()
| private

ObjectRegister<CommandLine> IG.Lib.CommandLine._register
| static private

Initial value:
=
new ObjectRegister<CommandLine>(1 )

Static object that providees object register and generates IDs for this class:

IdProxy IG.Lib.CommandLine._idPproxy
| private

Initial value:
=
new IdProxy(_register)

Proxy object that implements the IIdentifiable interface for this object.

SortedDictionary<CommandUseReference, string> IG.Lib.CommandLine._commandReferences
| private

Initial value:
=
new SortedDictionary<CommandUseReference, string>()

string IG.Lib.CommandLine._command
| protected

Temporary storage of command name for execution in a new thread.

string [] IG.Lib.CommandLine._arguments
| protected

Temporary storage of command arguments for execution in a new thread.

bool IG.Lib.CommandLine._threadStarted
| protected

Flag used to signal that command data has been picked by the executing thread and so object access can be unlocked.

## Property Documentation

object IG.Lib.CommandLine.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 int IG.Lib.CommandLine.Id
| get

Returns unique Id (in the scope of a given type) of the current object. Method is defined as virtual so that derived class can have its own IDs by defining its own static IdentifiableGenerator object.

ObjectRegister<CommandLine> IG.Lib.CommandLine.ObjectRegister
| get

Gets object register where the current object is registered.

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

- igbase/interpreters/InterpreterCommandLine.cs