summaryrefslogtreecommitdiffstats
path: root/src/Common/SystemBackend.cpp
diff options
context:
space:
mode:
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;
}
}