ARSTD::CommandProcessor Class Reference

List of all members.

Public Member Functions

void execute (boost::shared_ptr< Command > pCommand)
virtual void repeat ()
virtual bool push ()
virtual bool pop ()
virtual void cleanupHistory ()
void cleanup ()
void skipCurrent ()
bool isBusy ()
double getCurrentCommandProgress () const
std::string getCurrentCommandName () const
unsigned int getNumWaitingCommands () const

Detailed Description

This class encapsulates the management of commands. If commands are executed by the commandprocessor, they will be stored and executed one after another till all done.


Member Function Documentation

void ARSTD::CommandProcessor::execute ( boost::shared_ptr< Command pCommand  ) 

Execute the given command. If other commands are currently executed this command will be stored and executed next.

Parameters:
pCommand The command that will be added to the execution queue.

void ARSTD::CommandProcessor::repeat (  )  [virtual]

Repeates all commands that were previously executed.

bool ARSTD::CommandProcessor::push (  )  [virtual]

Copies the current context to a stack.

Returns:
True on success.

bool ARSTD::CommandProcessor::pop (  )  [virtual]

Restores the topmost context from a stack and makes it current.

Returns:
True on success.

void ARSTD::CommandProcessor::cleanupHistory (  )  [virtual]

Removes only executed commands that are stored.

void ARSTD::CommandProcessor::cleanup (  ) 

Removes all (executed and waiting) stored commands from the queue.

Postcondition:
isBusy() is false

void ARSTD::CommandProcessor::skipCurrent (  ) 

Removes the currently executing command and do the next (if available).

bool ARSTD::CommandProcessor::isBusy (  ) 

Returns true if the processor is currently executing a command otherwise false.

Returns:
True if currently executing a command otherwise false.

double ARSTD::CommandProcessor::getCurrentCommandProgress (  )  const

Returns the progress of the currently executing command.

Returns:
The progress of the executing command in range [0, 1]. If the processor is not busy -1 is returned.

std::string ARSTD::CommandProcessor::getCurrentCommandName (  )  const

Returns the name of the currently executing command.

Returns:
The current executing command name. If the processor is not busy "" is returned.

unsigned int ARSTD::CommandProcessor::getNumWaitingCommands (  )  const

Returns the number of commands that currently waits of its execution.

Returns:
The number of currently waiting commands.


Generated at 2 Jan 2007 for project CodeSubWars. www.codesubwars.org