ApparatusFramework::CmdInter Class Reference
[Diagnostic Services]

#include <DiagnosticServices/current/include/CmdInter.h>

Inheritance diagram for ApparatusFramework::CmdInter:
ApparatusFramework::Task

List of all members.

Classes

class  CmdInterListEntry

Public Member Functions

void initialize ()
void startup ()
CmdInterId addCmd (const char *cmdName, CmdInterFp pCmd, const char *cmdHelp)
bool removeCmd (CmdInterId cmdId)
bool removeCmd (char cmdName[])
bool executeCmd (const char *cmdName, const char *param)
bool executeCmd (CmdInterId cmdId, const char param[])
void setInputOutputDevices (const char *inputDeviceName, const char *outputDeviceName)
void printCmdText (const char *aFormat,...)
void runBody ()

Static Public Member Functions

static CmdInterCreate ()
static CmdInterDefault ()
static bool IsCreated ()

Static Public Attributes

static const CmdInterId IllegalCmdInterId

Friends

class CmdInterListEntry

Detailed Description

The class models a runnable object in our diagnostics services. The CmdInter object is simple Command Interpreter that takes strings from the console device and executes assigned commands. Commands may be registered with the command interpreter from outside.

Definition at line 89 of file CmdInter.h.


Member Function Documentation

CmdInterId ApparatusFramework::CmdInter::addCmd ( const char *  cmdName,
CmdInterFp  pCmd,
const char *  cmdHelp 
)

helpers Adds a new command to the command list of the interpreter.

Parameters:
cmdName a constant string that represents the name of the command. Its the name that has to be read over the console to execute the command.
pCmd a pointer to the method that represents the command.
cmdHelp a short constant string that is printed when help is typed.
Returns:
CmdInterId a unique command number > 0, may also be used as short cut to execute the command. 0 if the command was already registered.
static CmdInter* ApparatusFramework::CmdInter::Create (  )  [static]

singleton methods Creates an instance of the singleton if none exists yet. The object is created in static memory.

Returns:
A pointer to the created singleton instance.
static CmdInter* ApparatusFramework::CmdInter::Default (  )  [static]

References an instance that has been previously created.

Returns:
A pointer to the singleton instance.
bool ApparatusFramework::CmdInter::executeCmd ( CmdInterId  cmdId,
const char  param[] 
)

Executes a command given its unique id.

Parameters:
cmdId the id of the command.
param parameter to be given to the command.
Returns:
bool true: executed, false: not executed or execution failure.
bool ApparatusFramework::CmdInter::executeCmd ( const char *  cmdName,
const char *  param 
)

execute commands Executes a command given its name.

Parameters:
cmdName the name of the command.
param parameter to be given to the command.
Returns:
bool true: executed, false: not executed or execution failure.
void ApparatusFramework::CmdInter::initialize (  ) 

factory startup Initializes the CmdInter according to the factory startup pattern.

static bool ApparatusFramework::CmdInter::IsCreated (  )  [static]

States whether an instance of this singleton has been created.

Returns:
True if an instance has been created, false otherwise.
void ApparatusFramework::CmdInter::printCmdText ( const char *  aFormat,
  ... 
)

Print output to the cmd output device. Use it like printf.

Parameters:
aFormat the format string.
bool ApparatusFramework::CmdInter::removeCmd ( char  cmdName[]  ) 

Removes a command from the command list.

Parameters:
cmdName the name of the command to be removed.
Returns:
bool true: removed, false: not found.
bool ApparatusFramework::CmdInter::removeCmd ( CmdInterId  cmdId  ) 

Removes a command from the command list.

Parameters:
cmdId the id of the command to be removed.
Returns:
bool true: removed, false: not found.
void ApparatusFramework::CmdInter::runBody (  )  [virtual]

Task methods The tasks body.

Reimplemented from ApparatusFramework::Task.

void ApparatusFramework::CmdInter::setInputOutputDevices ( const char *  inputDeviceName,
const char *  outputDeviceName 
)

Sets the devices for input and output.

Parameters:
inputDeviceName the device name of the registred input device.
outputDeviceName the device name of the registred output device.
void ApparatusFramework::CmdInter::startup (  ) 

Starts up the CmdInter according to the factory startup pattern.


Friends And Related Function Documentation

friend class CmdInterListEntry [friend]

Declares the CmdInterListEntry class as a friend.

Definition at line 98 of file CmdInter.h.


Member Data Documentation

public constants

Definition at line 182 of file CmdInter.h.

© 2004-2010 bbv Software Services AG / Apparatus Services