From 62ca019532b28527facf6ab133742c2a190f15d6 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 17 Nov 2008 08:25:02 +0100 Subject: Configurable von Initializable ableiten; InformationManager ist jetzt auch ein Initializable --- src/Client/InformationManager.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/Client/InformationManager.h') diff --git a/src/Client/InformationManager.h b/src/Client/InformationManager.h index bf2d67a..739c359 100644 --- a/src/Client/InformationManager.h +++ b/src/Client/InformationManager.h @@ -24,6 +24,7 @@ #include #include +#include #include namespace Mad { @@ -39,7 +40,7 @@ class HostListPacket; namespace Client { -class InformationManager { +class InformationManager : public Common::Initializable { private: class DaemonStateUpdateRequest : public Common::RequestHandler { protected: @@ -49,32 +50,33 @@ class InformationManager { DaemonStateUpdateRequest() {} }; - static std::auto_ptr informationManager; + static InformationManager informationManager; std::map daemons; - bool initFinished; + + bool updating; // Prevent shallow copy InformationManager(const InformationManager &o); InformationManager& operator=(const InformationManager &o); - InformationManager(Net::Connection *connection); + InformationManager() : updating(false) {} void daemonListRequestFinished(const Common::Request &request); - public: - ~InformationManager(); + protected: + virtual void doInit(); + virtual void doUninit(); + public: static InformationManager* getInformationManager() { - return informationManager.get(); + return &informationManager; } - static void init(Net::Connection *connection) { - informationManager = std::auto_ptr(new InformationManager(connection)); - } + void updateDaemonList(Net::Connection *con); - bool isInitialised() const { - return initFinished; + bool isUpdating() const { + return updating; } const std::map& getDaemons() const { -- cgit v1.2.3