Guiliani  Version 2.5 revision 7293 (documentation build 13)
CGUICommandHandler Class Reference

Manages and executes instances of CGUICommand. More...

#include <GUICommandHandler.h>

Public Member Functions

void DumpCommands ()
 
void DumpQueues () const
 
eC_Bool Execute (CGUICommandPtr pkCommand)
 
eC_UInt GetIdleTime ()
 
eC_Bool IsCommandInQueue (CGUICommandPtr pkCommand)
 
void RemoveCommand (CGUICommandPtr pkCommand)
 
void SetMaxWorkingCmds (const eC_UInt &uiMaxNoOfWorkingCmds)
 

Static Public Member Functions

static void CreateInstance ()
 
static void DeleteInstance ()
 

Friends

class CGUI
 
class CGUICommand
 
class CGUIComponentManager
 

Detailed Description

Manages and executes instances of CGUICommand.

If a command ought to be executed, the method Execute() must be called. The command is not executed right away. Instead, it is enqueued according to its priority. The framework processes queued commands in each GUI main loop cycle. Processing a command means executing its Do() method.

Member Function Documentation

◆ CreateInstance()

static void CGUICommandHandler::CreateInstance ( )
static

Create Instance

◆ DeleteInstance()

static void CGUICommandHandler::DeleteInstance ( )
static

Delete Instance

◆ DumpCommands()

void CGUICommandHandler::DumpCommands ( )

Outputs debugging information about the commands in the queues. Thus, you can monitor the commands of each queue. This is only available if GUI_TRACE_LEVEL is set to GUI_TRACE_DEBUG

◆ DumpQueues()

void CGUICommandHandler::DumpQueues ( ) const

Outputs debugging information about the number of commands in the queues. This is useful for example to check whether when switching to a new dialog and back to the former one the number of command remains the same. For most applications this invariant applies.

◆ Execute()

eC_Bool CGUICommandHandler::Execute ( CGUICommandPtr  pkCommand)

Adds a command to the 'waiting commands' queue according to its waiting time and priority. The command will be executed (its CGUICommand::Do() method will be called) later.

Commands with the shortest waiting times are executed first. If any commands have the same waiting times, the ones with higher priorities are executed first. For commands with the same time and priority the execution order may be arbitrary.

Attention
Note that any command placed into the queue will be owned by the command handler. Do not delete the command yourself as commands are implemented as smart-pointers.
Parameters
pkCommandPointer to the command object to be added.
Returns
True if the command was successfully added, False if not.

◆ GetIdleTime()

eC_UInt CGUICommandHandler::GetIdleTime ( )

Returns the time in milliseconds until the next command in the 'working' or 'waiting' queue wishes to be processed again.

Returns
Idle time or 1000ms if no command is waiting.

◆ IsCommandInQueue()

eC_Bool CGUICommandHandler::IsCommandInQueue ( CGUICommandPtr  pkCommand)

Checks if the given command is currently enqueued in the command handler and waiting to be processed.

Parameters
pkCommandPointer to the command object which is to be checked
Returns
True if the command is enqueued in the command handler. False otherwise.

◆ RemoveCommand()

void CGUICommandHandler::RemoveCommand ( CGUICommandPtr  pkCommand)

Removes the given command from the command handler.

Parameters
pkCommandPointer to the command object to be removed.

◆ SetMaxWorkingCmds()

void CGUICommandHandler::SetMaxWorkingCmds ( const eC_UInt &  uiMaxNoOfWorkingCmds)
inline

Set the maximum number of commands in the internal working queue. There are two internal queues, the waiting queue and the working queue. The Execute() method enqueues a command in the waiting queue. The Process() method moves commands from the waiting into the working queue until either the waiting queue is empty or the maximum number of commands in the working queue is reached. Only commands in the working queue are actually executed.

Note that if this number is too low and there are a lot of unfinished commands in the working queue, some commands in the waiting queue may never be executed. The default value is 100 commands.

Parameters
uiMaxNoOfWorkingCmdsThe maximum number of commands in the working queue.

Friends And Related Function Documentation

◆ CGUI

friend class CGUI
friend

◆ CGUICommand

friend class CGUICommand
friend

◆ CGUIComponentManager

friend class CGUIComponentManager
friend

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