#include <commander.h>
Inherits Task.
Inherited by CommanderClient, and CommanderServer.
Inheritance diagram for Commander:


Public Member Functions | |
| Commander () | |
| virtual | ~Commander () |
| void | addCommand (const std::string &command, int playerID=-1) |
| Add command to command queues. | |
| void | processAllCommands () |
| Process all commands in queue. | |
| virtual void | update (int atime) |
| Equal to processAllCommands(). | |
Protected Types | |
| typedef Commander::sCommand | sCommand |
| Mutex for commands queueHolds info abou one message in queue. | |
Protected Member Functions | |
| virtual void | processCommand (const std::string &command, int playerID)=0 |
| Process one command. | |
Protected Attributes | |
| Mutex | mQueueMutex |
| std::list< sCommand > | mCommQueue |
| Queue of commands that are waiting for processing. | |
Classes | |
| struct | sCommand |
| Mutex for commands queueHolds info abou one message in queue. More... | |
Accepts users commands from console and from network. Inherits from Task so you may put it in task manager. The commander needs regular processAllCommands(); call or update call will do the same job.
Definition at line 22 of file commander.h.
|
|
Mutex for commands queueHolds info abou one message in queue.
|
|
|
Definition at line 25 of file commander.h. |
|
|
Definition at line 26 of file commander.h. |
|
||||||||||||
|
Add command to command queues. The command will be processed later in main thread. This function is thread safe. Add one element to mCommQueue. Command will be processed in processAllCommands() call.
Definition at line 8 of file commander.cpp. References Mutex::lock(), mCommQueue, mQueueMutex, and Mutex::unlock(). Referenced by Console::processCommand(), and ConsoleText::run(). Here is the call graph for this function: ![]() |
|
|
Process all commands in queue. This should be regullary called from main thread. Simplye emty mCommQueue and call processCommand on every member if the list. Definition at line 19 of file commander.cpp. References Commander::sCommand::command, Mutex::lock(), mCommQueue, mQueueMutex, Commander::sCommand::playerID, processCommand(), and Mutex::unlock(). Referenced by GameClient::run(), and update(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Process one command. This function will be called in main task. Should process the command.
Implemented in CommanderClient, and CommanderServer. Referenced by processAllCommands(). |
|
|
Equal to processAllCommands(). This fucntion is here if you need to put commander in task manager. Reimplemented from Task. Definition at line 40 of file commander.cpp. References processAllCommands(). Here is the call graph for this function: ![]() |
|
|
Queue of commands that are waiting for processing. Use mQueueMutex when accessing the. Definition at line 96 of file commander.h. Referenced by addCommand(), and processAllCommands(). |
|
|
Definition at line 74 of file commander.h. Referenced by addCommand(), and processAllCommands(). |
1.4.5