From bea0bb0ff40dca9e5dba55c697c30e4fffaf0f66 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 24 Sep 2008 15:23:27 +0200 Subject: Erlaube mehrere System-Backends --- src/Common/SystemBackend.h | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'src/Common/SystemBackend.h') diff --git a/src/Common/SystemBackend.h b/src/Common/SystemBackend.h index 8ba1e7d..960082e 100644 --- a/src/Common/SystemBackend.h +++ b/src/Common/SystemBackend.h @@ -20,24 +20,12 @@ #ifndef MAD_COMMON_SYSTEMBACKEND_H_ #define MAD_COMMON_SYSTEMBACKEND_H_ -#include -#include -#include +#include namespace Mad { namespace Common { class SystemBackend { - private: - static std::auto_ptr backend; - - protected: - SystemBackend() {} - - static void setBackend(std::auto_ptr backend0) { - backend = backend0; - } - public: struct UptimeInfo { unsigned long uptime; @@ -59,26 +47,41 @@ class SystemBackend { float loadAvg15; }; - virtual ~SystemBackend() {} + private: + static std::set backends; + + protected: + SystemBackend() {} + + static void registerBackend(SystemBackend *backend) { + backends.insert(backend); + } + + static void unregisterBackend(SystemBackend *backend) { + backends.erase(backend); + } - virtual UptimeInfo getUptimeInfo() { + virtual UptimeInfo uptimeInfo() { UptimeInfo ret = {0, 0}; return ret; } - virtual MemoryInfo getMemoryInfo() { + virtual MemoryInfo memoryInfo() { MemoryInfo ret = {0, 0, 0, 0}; return ret; } - virtual LoadInfo getLoadInfo() { + virtual LoadInfo loadInfo() { LoadInfo ret = {0, 0, 0, 0, 0}; return ret; } - static SystemBackend *getBackend() { - return backend.get(); - } + public: + virtual ~SystemBackend() {} + + static UptimeInfo getUptimeInfo(); + static MemoryInfo getMemoryInfo(); + static LoadInfo getLoadInfo(); }; } -- cgit v1.2.3