00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _GLASS_CLIENT_HH_
00022 #define _GLASS_CLIENT_HH_
00023
00024 #include <set>
00025
00026 #include "glass.h"
00027 #include "types.h"
00028 #include "exception.h"
00029 #include "thread.h"
00030
00031 namespace libglass {
00032
00033 class Protocol;
00034
00035 class LIBGLASS_API GlassClient : public Glass, protected GlassThread {
00036 private:
00037 bool initialized;
00038 bool quitting;
00040 unsigned int totalnodes;
00041 std::set<nodeId> clientlist;
00043 bool ismaster;
00044 protected:
00045 string server;
00047 boost::condition_variable cond;
00048 boost::mutex mut;
00049 nodeId serverId;
00054 void execute(void);
00055
00059 void cleanup(void);
00060
00061 bool sendPacket(Packet &p);
00062
00063 virtual bool rootPacket(Packet &p);
00064
00065 virtual nodeId registerNode(nodeFD fd);
00066
00067 #ifdef TODO
00068 virtual bool unregisterNode(nodeId id);
00069 virtual bool unregisterNode(nodeFD fd);
00070 #endif
00071
00072 public:
00079 GlassClient(Protocol *p, const char *server) throw(Exception);
00080
00081 ~GlassClient();
00082
00100 unsigned int getTotalNodes(void);
00101
00116 std::set<nodeId> getClientList(void);
00117
00129 bool isMaster(void);
00130
00131
00135 void killAll(void);
00136
00137 };
00138
00139 }
00140
00141 #endif // _GLASS_CLIENT_HH_