Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

CommandQueue Class Reference

Inheritance diagram for CommandQueue:

Inheritance graph
[legend]
Collaboration diagram for CommandQueue:

Collaboration graph
[legend]

Detailed Description

Queue for sequential commands.

Definition at line 13 of file CommandQueue.h.

Public Member Functions

 CommandQueue ()
virtual ~CommandQueue ()
 Remove all commands.
void planCommand (Command *new_command)
 Add new command at the end of queue.
bool executeFirst ()
 Execute first command.
void removeAll ()
 Remove all commands.
bool empty () const


Constructor & Destructor Documentation

CommandQueue::CommandQueue  ) 
 

Definition at line 14 of file CommandQueue.cpp.

00015 {
00016     m_count = 0;
00017 }

CommandQueue::~CommandQueue  )  [virtual]
 

Remove all commands.

Definition at line 22 of file CommandQueue.cpp.

00023 {
00024     removeAll();
00025 }


Member Function Documentation

bool CommandQueue::empty  )  const [inline]
 

Definition at line 25 of file CommandQueue.h.

00025 { return m_commands.empty(); }

bool CommandQueue::executeFirst  ) 
 

Execute first command.

Execute none command when queue is empty. If the command returns true, remove him from queue.

Returns:
true when a command was executed

Definition at line 43 of file CommandQueue.cpp.

00044 {
00045     bool result = false;
00046     if (!m_commands.empty()) {
00047         Command *command = m_commands.front();
00048         if (command->finish(m_count)) {
00049             m_commands.pop_front();
00050             m_count = 0;
00051             delete command;
00052         }
00053         else {
00054             m_count++;
00055         }
00056         result = true;
00057     }
00058 
00059     return result;
00060 }

void CommandQueue::planCommand Command new_command  ) 
 

Add new command at the end of queue.

Definition at line 31 of file CommandQueue.cpp.

00032 {
00033     m_commands.push_back(new_command);
00034 }

void CommandQueue::removeAll  ) 
 

Remove all commands.

Definition at line 66 of file CommandQueue.cpp.

00067 {
00068     t_commands::iterator end = m_commands.end();
00069     for (t_commands::iterator i = m_commands.begin(); i != end; ++i) {
00070         delete (*i);
00071     }
00072     m_commands.clear();
00073     m_count = 0;
00074 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:54:42 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2