summaryrefslogtreecommitdiffstats
path: root/src/Common/SystemBackend.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/SystemBackend.h')
-rw-r--r--src/Common/SystemBackend.h51
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);
};
}