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

- Main Page
- Namespaces
- Classes
- Files
- Directories

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

Public Member Functions | Protected Member Functions | Protected Attributes | Properties | Private Member Functions | Private Attributes | Static Private Attributes

# IG::Lib::CommandLine Class Reference

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]

List of all members.

## Public Member Functions
| CommandLine ()
| Creates a new command that can be used in command-line interpreters.
void | Register ()
| Registers the current object. Subsequent calls (after the first one) have no effect.
bool | IsRegistered ()
| Returns true if the current object is registered, false if not.
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.
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}).
void | RemoveCommandReference (int interpreterId, string commandName)
| Removes command uage reference. This method should be called whenever a command is uninstalled form interpreter.
abstract void | Dispose ()
| Clean up after the reference is not used any 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.
## Protected Attributes
string | _command
| Temporary storage of command name for execution in a new thread.
string[] | _arguments
| Temporary storage of command arguments for execution in a new thread.
bool | _threadStarted
| Flag used to signal that command data has been picked by the executing thread and so object access can be unlocked.
## 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.
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.
ObjectRegister< CommandLine > | ObjectRegister`[get]`
| Gets object register where the current object is registered.
## Private Member Functions
| ~CommandLine ()
## Private Attributes
object | _mainLock = new object()
IdProxy | _idPproxy
| Proxy object that implements the IIdentifiable interface for this object.
SortedDictionary < CommandUseReference, string > | _commandReferences
## Static Private Attributes
static ObjectRegister < CommandLine > | _register
| Static object that providees object register and generates IDs for this class:

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

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.

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.

Implements IG::Lib::ILockable.

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.

Implements IG::Lib::IIdentifiable.

ObjectRegister<CommandLine> IG::Lib::CommandLine::ObjectRegister`[get]`

Gets object register where the current object is registered.

Implements IG::Lib::IRegisterable< T >.

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

- InterpreterCommandLine.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events