diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-10-03 01:30:27 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-10-03 01:30:27 +0200 |
commit | 426d60a6992259ca80431c59e916073cc31f5261 (patch) | |
tree | ce88e01006e91ce4c159afc645777f9b458110b3 /src/Common/SystemBackend.h | |
parent | 2f5eba3ce1bddf30b23444042f955adc10d84855 (diff) | |
download | mad-426d60a6992259ca80431c59e916073cc31f5261.tar mad-426d60a6992259ca80431c59e916073cc31f5261.zip |
Callback-basierte SystemBackends f?r h?here Flexibilit?t
Diffstat (limited to 'src/Common/SystemBackend.h')
-rw-r--r-- | src/Common/SystemBackend.h | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/src/Common/SystemBackend.h b/src/Common/SystemBackend.h index d9506a9..c8eee69 100644 --- a/src/Common/SystemBackend.h +++ b/src/Common/SystemBackend.h @@ -21,32 +21,12 @@ #define MAD_COMMON_SYSTEMBACKEND_H_ #include <set> +#include <sigc++/signal.h> namespace Mad { namespace Common { class SystemBackend { - public: - struct UptimeInfo { - unsigned long uptime; - unsigned long idleTime; - }; - - struct MemoryInfo { - unsigned long totalMem; - unsigned long freeMem; - unsigned long totalSwap; - unsigned long freeSwap; - }; - - struct LoadInfo { - unsigned long currentLoad; - unsigned long nProcesses; - float loadAvg1; - float loadAvg5; - float loadAvg15; - }; - private: struct Compare { bool operator() (const SystemBackend *b1, const SystemBackend *b2) { @@ -70,23 +50,20 @@ class SystemBackend { backends.erase(backend); } - virtual UptimeInfo uptimeInfo() { - UptimeInfo ret = {0, 0}; - return ret; + virtual bool uptimeInfo(const sigc::slot<void, unsigned long, unsigned long>&) { + return false; } - virtual MemoryInfo memoryInfo() { - MemoryInfo ret = {0, 0, 0, 0}; - return ret; + virtual bool memoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long>&) { + return false; } - virtual LoadInfo loadInfo() { - LoadInfo ret = {0, 0, 0, 0, 0}; - return ret; + virtual bool loadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float>&) { + return false; } - virtual bool doShutdown() {return false;} - virtual bool doReboot() {return false;} + virtual bool doShutdown(const sigc::slot<void>&) {return false;} + virtual bool doReboot(const sigc::slot<void>&) {return false;} virtual int getPriority() const { return 0; @@ -95,12 +72,12 @@ class SystemBackend { public: virtual ~SystemBackend() {} - static UptimeInfo getUptimeInfo(); - static MemoryInfo getMemoryInfo(); - static LoadInfo getLoadInfo(); + static bool getUptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback); + static bool getMemoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback); + static bool getLoadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback); - static bool shutdown(); - static bool reboot(); + static bool shutdown(const sigc::slot<void> &callback); + static bool reboot(const sigc::slot<void> &callback); }; } |