diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-05-22 14:21:06 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-05-22 14:21:06 +0200 |
commit | 0480576d43fb7ddcc16de9dab0619a1424f129fd (patch) | |
tree | 633f11b0ee7b9bfe20478cd47e8d6ec397627ad5 /src/Common/SystemManager.cpp | |
parent | 264cd7947d7291f78065f12824523ba6178a9936 (diff) | |
download | mad-0480576d43fb7ddcc16de9dab0619a1424f129fd.tar mad-0480576d43fb7ddcc16de9dab0619a1424f129fd.zip |
SystemBackend ?berarbeitet
Diffstat (limited to 'src/Common/SystemManager.cpp')
-rw-r--r-- | src/Common/SystemManager.cpp | 96 |
1 files changed, 72 insertions, 24 deletions
diff --git a/src/Common/SystemManager.cpp b/src/Common/SystemManager.cpp index c5eac0e..3c89a33 100644 --- a/src/Common/SystemManager.cpp +++ b/src/Common/SystemManager.cpp @@ -34,58 +34,106 @@ bool SystemManager::Compare::operator() (boost::shared_ptr<SystemBackend> b1, bo } -bool SystemManager::getUptimeInfo(unsigned long *uptime, unsigned long *idleTime) { +void SystemManager::getUptimeInfo(unsigned long *uptime, unsigned long *idleTime) throw(Net::Exception) { + Net::Exception e(Net::Exception::NOT_IMPLEMENTED); + for(std::set<boost::shared_ptr<SystemBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - if((*backend)->getUptimeInfo(uptime, idleTime)) - return true; + try { + (*backend)->getUptimeInfo(uptime, idleTime); + return; + } + catch(Net::Exception e2) { + if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + e = e2; + } } - return false; + throw e; } -bool SystemManager::getMemoryInfo(unsigned long *totalMem, unsigned long *freeMem, unsigned long *totalSwap, unsigned long *freeSwap) { +void SystemManager::getMemoryInfo(unsigned long *totalMem, unsigned long *freeMem, unsigned long *totalSwap, unsigned long *freeSwap) throw(Net::Exception) { + Net::Exception e(Net::Exception::NOT_IMPLEMENTED); + for(std::set<boost::shared_ptr<SystemBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - if((*backend)->getMemoryInfo(totalMem, freeMem, totalSwap, freeSwap)) - return true; + try { + (*backend)->getMemoryInfo(totalMem, freeMem, totalSwap, freeSwap); + return; + } + catch(Net::Exception e2) { + if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + e = e2; + } } - return false; + throw e; } -bool SystemManager::getLoadInfo(unsigned long *currentLoad, unsigned long *nProcesses, float *loadAvg1, float *loadAvg5, float *loadAvg15) { +void SystemManager::getLoadInfo(unsigned long *currentLoad, unsigned long *nProcesses, float *loadAvg1, float *loadAvg5, float *loadAvg15) throw(Net::Exception) { + Net::Exception e(Net::Exception::NOT_IMPLEMENTED); + for(std::set<boost::shared_ptr<SystemBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - if((*backend)->getLoadInfo(currentLoad, nProcesses, loadAvg1, loadAvg5, loadAvg15)) - return true; + try { + (*backend)->getLoadInfo(currentLoad, nProcesses, loadAvg1, loadAvg5, loadAvg15); + return; + } + catch(Net::Exception e2) { + if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + e = e2; + } } - return false; + throw e; } -bool SystemManager::getFSInfo(std::vector<FSInfo> *fsInfo) { +void SystemManager::getFSInfo(std::vector<FSInfo> *fsInfo) throw(Net::Exception) { + Net::Exception e(Net::Exception::NOT_IMPLEMENTED); + for(std::set<boost::shared_ptr<SystemBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - if((*backend)->getFSInfo(fsInfo)) - return true; + try { + (*backend)->getFSInfo(fsInfo); + return; + } + catch(Net::Exception e2) { + if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + e = e2; + } } - return false; + throw e; } -bool SystemManager::shutdown() { +void SystemManager::shutdown() throw(Net::Exception) { + Net::Exception e(Net::Exception::NOT_IMPLEMENTED); + for(std::set<boost::shared_ptr<SystemBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - if((*backend)->shutdown()) - return true; + try { + (*backend)->shutdown(); + return; + } + catch(Net::Exception e2) { + if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + e = e2; + } } - return false; + throw e; } -bool SystemManager::reboot() { +void SystemManager::reboot() throw(Net::Exception) { + Net::Exception e(Net::Exception::NOT_IMPLEMENTED); + for(std::set<boost::shared_ptr<SystemBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - if((*backend)->reboot()) - return true; + try { + (*backend)->reboot(); + return; + } + catch(Net::Exception e2) { + if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + e = e2; + } } - return false; + throw e; } } |