diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-09-24 15:23:27 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-09-24 15:23:27 +0200 |
commit | bea0bb0ff40dca9e5dba55c697c30e4fffaf0f66 (patch) | |
tree | 034ed13ba0214fb8d324cd56b1e1a207f5aff0ff /src/Common/SystemBackend.h | |
parent | fae8ca32af7407653d21f7cbc4e9ea79751faab8 (diff) | |
download | mad-bea0bb0ff40dca9e5dba55c697c30e4fffaf0f66.tar mad-bea0bb0ff40dca9e5dba55c697c30e4fffaf0f66.zip |
Erlaube mehrere System-Backends
Diffstat (limited to 'src/Common/SystemBackend.h')
-rw-r--r-- | src/Common/SystemBackend.h | 43 |
1 files changed, 23 insertions, 20 deletions
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 <stdint.h> -#include <string> -#include <memory> +#include <set> namespace Mad { namespace Common { class SystemBackend { - private: - static std::auto_ptr<SystemBackend> backend; - - protected: - SystemBackend() {} - - static void setBackend(std::auto_ptr<SystemBackend> backend0) { - backend = backend0; - } - public: struct UptimeInfo { unsigned long uptime; @@ -59,26 +47,41 @@ class SystemBackend { float loadAvg15; }; - virtual ~SystemBackend() {} + private: + static std::set<SystemBackend*> 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(); }; } |