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.CommandLineInterpreter Class Reference

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

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

Public Member Functions

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 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. More...
 
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. More...
 
void RemoveCommand (string commandName)
 Removes the specified command reference from the interpreter. More...
 
void RenameCommand (string oldCommandName, string newCommandName)
 Renames the specified command. More...
 
virtual void Dispose ()
 Clean up after the reference is not used any more. More...
 
- Public Member Functions inherited from IG.Lib.InterpreterBase< TCommand, TCommandData >
abstract void AddCommand (string commandName, TCommand command)
 

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. 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
< CommandLineInterpreter
ObjectRegister [get]
 Gets object register where the current object is registered. More...
 
SortedDictionary< string,
CommandLine
Commands [get]
 
char Separator [get, protected set]
 
- 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

 ~CommandLineInterpreter ()
 

Private Attributes

object _mainLock = new object()
 
IdProxy _idPproxy
 Proxy object that implements the IIdentifiable interface for this object. More...
 
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: More...
 

Detailed Description

Base class for all command line interpreters.

Constructor & Destructor Documentation

IG.Lib.CommandLineInterpreter.~CommandLineInterpreter ( )
inlineprivate

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
commandNameCommand name through which interpreter will be able to invoke the command.
commandCommand to be added to the interpreter.
referenceDescriptionDescription 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.

References IG.Lib.CommandLine.AddCommandReference().

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
commandNameCommand name through which interpreter will be able to invoke the command.
commandCommand to be added to the interpreter.
void IG.Lib.CommandLineInterpreter.RemoveCommand ( string  commandName)
inline

Removes the specified command reference from the interpreter.

Parameters
commandNameName 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.

References IG.Lib.CommandLine.RemoveCommandReference().

void IG.Lib.CommandLineInterpreter.RenameCommand ( string  oldCommandName,
string  newCommandName 
)
inline

Renames the specified command.

Parameters
oldCommandName
newCommandName
CommandLine IG.Lib.CommandLineInterpreter.GetCommand ( string  commandName)
inlineprotected

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

Parameters
commandNameCommand name. Must not be null or empty string!
Returns
Command corresponding to the specified command name.
virtual void IG.Lib.CommandLineInterpreter.Dispose ( )
inlinevirtual

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

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.

ObjectRegister<CommandLineInterpreter> IG.Lib.CommandLineInterpreter.ObjectRegister
get

Gets object register where the current object is registered.

SortedDictionary<string, CommandLine> IG.Lib.CommandLineInterpreter.Commands
getprotected
char IG.Lib.CommandLineInterpreter.Separator
getprotected set

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