commander.h

Go to the documentation of this file.
00001 /* MANTAINER: Bernard */
00002 
00003 #ifndef _COMMANDER_H
00004 #define _COMMANDER_H
00005 
00006 
00007 #include <string>
00008 #include <list>
00009 
00010 
00011 #include "mutex.h"
00012 #include "task.h"
00013 
00022 class Commander : public Task
00023 {
00024 public:
00025         Commander() { };
00026         virtual ~Commander() { };
00027 
00044         void addCommand(const std::string &command, int playerID = -1);
00045 
00053         void processAllCommands();
00054 
00061         virtual void update(int atime);
00062         
00063 protected:
00064 
00072         virtual void processCommand(const std::string &command, int playerID) = 0;
00073 
00074         Mutex mQueueMutex; 
00075 
00079         typedef struct sCommand
00080         {
00082                 sCommand(const std::string &cmd, int plID)
00083                 {
00084                         command  = cmd;
00085                         playerID = plID;
00086                 }
00087                 std::string command;  
00088                 int         playerID; 
00089         } sCommand;
00090 
00096         std::list<sCommand> mCommQueue;
00097 };
00098 
00099 
00100 
00101 #endif

Generated on Wed Apr 12 13:55:27 2006 for bjs by  doxygen 1.4.5