diff options
Diffstat (limited to 'src/Client/InformationManager.h')
-rw-r--r-- | src/Client/InformationManager.h | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/Client/InformationManager.h b/src/Client/InformationManager.h index ffc24cf..ab84e3c 100644 --- a/src/Client/InformationManager.h +++ b/src/Client/InformationManager.h @@ -23,10 +23,9 @@ #include <map> #include <memory> -#include <Core/Initializable.h> - #include <Common/HostInfo.h> #include <Common/Request.h> +#include <Common/RequestHandlerGroup.h> #include <Common/RequestHandlers/SimpleRequestHandler.h> #include <boost/thread/condition_variable.hpp> @@ -36,17 +35,23 @@ namespace Mad { namespace Client { -class InformationManager : public Core::Initializable, private boost::noncopyable { +class Application; + +class InformationManager : private boost::noncopyable { private: class DaemonStateUpdateRequestHandler : public Common::RequestHandlers::SimpleRequestHandler { private: - static void handleRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret); + void handleRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret); public: - DaemonStateUpdateRequestHandler() : Common::RequestHandlers::SimpleRequestHandler("UpdateHostState", &DaemonStateUpdateRequestHandler::handleRequest) {} + DaemonStateUpdateRequestHandler(Common::Application *application) + : Common::RequestHandlers::SimpleRequestHandler(application, "UpdateHostState", + boost::bind(&DaemonStateUpdateRequestHandler::handleRequest, this, _1, _2)) {} }; - static InformationManager informationManager; + friend class Application; + + Application *application; boost::mutex mutex; @@ -56,19 +61,12 @@ class InformationManager : public Core::Initializable, private boost::noncopyabl bool updating; - InformationManager() : updating(false) {} - void daemonListRequestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Core::Exception error); - protected: - virtual void doInit(); - virtual void doDeinit(); + InformationManager(Application *application0); + ~InformationManager(); public: - static InformationManager *get() { - return &informationManager; - } - void updateDaemonList(Common::Connection *con); bool isUpdating() { |