summaryrefslogtreecommitdiffstats
path: root/src/Common/SystemBackend.cpp
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2008-10-03 01:30:27 +0200
committerMatthias Schiffer <matthias@gamezock.de>2008-10-03 01:30:27 +0200
commit426d60a6992259ca80431c59e916073cc31f5261 (patch)
treece88e01006e91ce4c159afc645777f9b458110b3 /src/Common/SystemBackend.cpp
parent2f5eba3ce1bddf30b23444042f955adc10d84855 (diff)
downloadmad-426d60a6992259ca80431c59e916073cc31f5261.tar
mad-426d60a6992259ca80431c59e916073cc31f5261.zip
Callback-basierte SystemBackends f?r h?here Flexibilit?t
Diffstat (limited to 'src/Common/SystemBackend.cpp')
-rw-r--r--src/Common/SystemBackend.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/Common/SystemBackend.cpp b/src/Common/SystemBackend.cpp
index c017356..06a2898 100644
--- a/src/Common/SystemBackend.cpp
+++ b/src/Common/SystemBackend.cpp
@@ -25,49 +25,49 @@ namespace Common {
std::set<SystemBackend*, SystemBackend::Compare> SystemBackend::backends;
-SystemBackend::UptimeInfo SystemBackend::getUptimeInfo() {
- UptimeInfo ret = {0, 0};
+bool SystemBackend::getUptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback) {
+ for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ if((*backend)->uptimeInfo(callback))
+ return true;
+ }
- for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end() && ret.uptime == 0; ++backend)
- ret = (*backend)->uptimeInfo();
-
- return ret;
+ return false;
}
-SystemBackend::MemoryInfo SystemBackend::getMemoryInfo() {
- MemoryInfo ret = {0, 0, 0, 0};
-
- for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end() && ret.totalMem == 0; ++backend)
- ret = (*backend)->memoryInfo();
+bool SystemBackend::getMemoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback) {
+ for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ if((*backend)->memoryInfo(callback))
+ return true;
+ }
- return ret;
+ return false;
}
-SystemBackend::LoadInfo SystemBackend::getLoadInfo() {
- LoadInfo ret = {0, 0, 0, 0, 0};
-
- for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end() && ret.currentLoad == 0 && ret.loadAvg1 == 0 && ret.nProcesses == 0; ++backend)
- ret = (*backend)->loadInfo();
+bool SystemBackend::getLoadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback) {
+ for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ if((*backend)->loadInfo(callback))
+ return true;
+ }
- return ret;
+ return false;
}
-bool SystemBackend::shutdown() {
- bool ret = false;
+bool SystemBackend::shutdown(const sigc::slot<void> &callback) {
+ for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ if((*backend)->doShutdown(callback))
+ return true;
+ }
- for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end() && !ret; ++backend)
- ret = (*backend)->doShutdown();
-
- return ret;
+ return false;
}
-bool SystemBackend::reboot() {
- bool ret = false;
-
- for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end() && !ret; ++backend)
- ret = (*backend)->doReboot();
+bool SystemBackend::reboot(const sigc::slot<void> &callback) {
+ for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ if((*backend)->doReboot(callback))
+ return true;
+ }
- return ret;
+ return false;
}
}