diff options
Diffstat (limited to 'src/Client/InformationManager.h')
-rw-r--r-- | src/Client/InformationManager.h | 26 |
1 files changed, 14 insertions, 12 deletions
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 <memory> #include <Common/HostInfo.h> +#include <Common/Initializable.h> #include <Common/Request.h> 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> informationManager; + static InformationManager informationManager; std::map<std::string, Common::HostInfo> 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<Net::Packets::HostListPacket> &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<InformationManager>(new InformationManager(connection)); - } + void updateDaemonList(Net::Connection *con); - bool isInitialised() const { - return initFinished; + bool isUpdating() const { + return updating; } const std::map<std::string, Common::HostInfo>& getDaemons() const { |