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 |
|
Definition at line 14 of file CommandQueue.cpp. 00015 { 00016 m_count = 0; 00017 }
|
|
Remove all commands.
Definition at line 22 of file CommandQueue.cpp. 00023 { 00024 removeAll(); 00025 }
|
|
Definition at line 25 of file CommandQueue.h. 00025 { return m_commands.empty(); }
|
|
Execute first command. Execute none command when queue is empty. If the command returns true, remove him from queue.
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 }
|
|
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 }
|
|
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 }
|