| 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 | Properties | Private Member Functions | Private Attributes | Static Private Attributes

# IG::Lib::CommandLineInterpreter Class Reference

Base class for all command line interpreters. More...

Inheritance diagram for IG::Lib::CommandLineInterpreter:
[legend]
Collaboration diagram for IG::Lib::CommandLineInterpreter:
[legend]

List of all members.

## Public Member Functions
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 | AddCommand (string commandName, CommandLine command, string referenceDescription)
| Adds a new command to the interpreter. If the command with the specified name already exists then the command is replaced.
override void | AddCommand (string commandName, CommandLine command)
| Adds a new command to the interpreter. If the command with the specified name already exists then the command is replaced.
void | RemoveCommand (string commandName)
| Removes the specified command reference from the interpreter.
void | RenameCommand (string oldCommandName, string newCommandName)
| Renames the specified command.
virtual void | Dispose ()
| Clean up after the reference is not used any more.
## Protected Member Functions
CommandLine | GetCommand (string commandName)
| Returns the command that is registered under the specified name, or null if there is no such command.
## 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 < CommandLineInterpreter > | ObjectRegister`[get]`
| Gets object register where the current object is registered.
SortedDictionary< string, CommandLine > | Commands`[get]`
char | Separator`[get, set]`
## Private Member Functions
| ~CommandLineInterpreter ()
## Private Attributes
object | _mainLock = new object()
IdProxy | _idPproxy
| Proxy object that implements the IIdentifiable interface for this object.
SortedDictionary< string, CommandLine > | _commands = new SortedDictionary<string,CommandLine>()
char | _separator = ','
## Static Private Attributes
static ObjectRegister < CommandLineInterpreter > | _register
| Static object that providees object register and generates IDs for this class:

## Detailed Description

Base class for all command line interpreters.

## Constructor & Destructor Documentation

IG::Lib::CommandLineInterpreter::~CommandLineInterpreter | ( |  | ) | `[inline, private]`

## Member Function Documentation

void IG::Lib::CommandLineInterpreter::Register | ( |  | ) | `[inline]`

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

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

bool IG::Lib::CommandLineInterpreter::IsRegistered | ( |  | ) | `[inline]`

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

Returns:

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

void IG::Lib::CommandLineInterpreter::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::CommandLineInterpreter::AddCommand | ( | string | commandName,
|  | CommandLine | command,
|  | string | referenceDescription
| ) |  | `[inline]`

Adds a new command to the interpreter. If the command with the specified name already exists then the command is replaced.

Parameters:

  commandName | Command name through which interpreter will be able to invoke the command.
  command | Command to be added to the interpreter.
  referenceDescription | Description of command reference (data structure that includes the command, interpreter where command is installed, and name under which command is registered on the interpretere). These data are used in order to know when command is not referenced any more, so its finalization block can be performed.

override void IG::Lib::CommandLineInterpreter::AddCommand | ( | string | commandName,
|  | CommandLine | command
| ) |  | `[inline]`

Adds a new command to the interpreter. If the command with the specified name already exists then the command is replaced.

Parameters:

  commandName | Command name through which interpreter will be able to invoke the command.
  command | Command to be added to the interpreter.
  referenceDescription | Description of command reference (data structure that includes the command, interpreter where command is installed, and name under which command is registered on the interpretere). These data are used in order to know when command is not referenced any more, so its finalization block can be performed.

void IG::Lib::CommandLineInterpreter::RemoveCommand | ( | string | commandName | ) | `[inline]`

Removes the specified command reference from the interpreter.

Parameters:

  commandName | Name that identifies the command on this interpreter. Note that any command can be registered under different names, but each command name references only one command.

void IG::Lib::CommandLineInterpreter::RenameCommand | ( | string | oldCommandName,
|  | string | newCommandName
| ) |  | `[inline]`

Renames the specified command.

Parameters:

  oldCommandName |
  newCommandName |

CommandLine IG::Lib::CommandLineInterpreter::GetCommand | ( | string | commandName | ) | `[inline, protected]`

Returns the command that is registered under the specified name, or null if there is no such command.

Parameters:

  commandName | Command name. Must not be null or empty string!

Returns:
  Command corresponding to the specified command name.

virtual void IG::Lib::CommandLineInterpreter::Dispose | ( |  | ) | `[inline, virtual]`

Clean up after the reference is not used any more.

## Member Data Documentation

object IG::Lib::CommandLineInterpreter::_mainLock = new object()`[private]`

ObjectRegister<CommandLineInterpreter> IG::Lib::CommandLineInterpreter::_register`[static, private]`

Initial value:

                new ObjectRegister<CommandLineInterpreter>(1 )

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

IdProxy IG::Lib::CommandLineInterpreter::_idPproxy`[private]`

Initial value:

                new IdProxy(_register)

Proxy object that implements the IIdentifiable interface for this object.

SortedDictionary<string, CommandLine> IG::Lib::CommandLineInterpreter::_commands = new SortedDictionary<string,CommandLine>()`[private]`

char IG::Lib::CommandLineInterpreter::_separator = ','`[private]`

## Property Documentation

object IG::Lib::CommandLineInterpreter::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::CommandLineInterpreter::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<CommandLineInterpreter> IG::Lib::CommandLineInterpreter::ObjectRegister`[get]`

Gets object register where the current object is registered.

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

SortedDictionary<string, CommandLine> IG::Lib::CommandLineInterpreter::Commands`[get, protected]`

char IG::Lib::CommandLineInterpreter::Separator`[get, set]`

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

- InterpreterCommandLine.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events