summaryrefslogtreecommitdiffstats
path: root/src/modules/SystemBackendProc/SystemBackendProc.h
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-05-21 01:42:33 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-05-21 01:42:33 +0200
commit73667d1102735c42cf385442aeb2a1735bb67d6a (patch)
treef0044dc9324ab0c15e63926bb22910d34a684b46 /src/modules/SystemBackendProc/SystemBackendProc.h
parent9c076d2649ff8c6997c2dec1e1ef4f7359d404ec (diff)
downloadmad-73667d1102735c42cf385442aeb2a1735bb67d6a.tar
mad-73667d1102735c42cf385442aeb2a1735bb67d6a.zip
SystemBackend-Interface ueberarbeitet
Diffstat (limited to 'src/modules/SystemBackendProc/SystemBackendProc.h')
-rw-r--r--src/modules/SystemBackendProc/SystemBackendProc.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/modules/SystemBackendProc/SystemBackendProc.h b/src/modules/SystemBackendProc/SystemBackendProc.h
index bf19e22..9b36df4 100644
--- a/src/modules/SystemBackendProc/SystemBackendProc.h
+++ b/src/modules/SystemBackendProc/SystemBackendProc.h
@@ -23,13 +23,14 @@
#include <Common/SystemBackend.h>
#include <fstream>
+#include <boost/noncopyable.hpp>
namespace Mad {
namespace Modules {
-class SystemBackendProc : private Common::SystemBackend {
+class SystemBackendProc : public Common::SystemBackend, boost::noncopyable {
private:
- static SystemBackendProc *backend;
+ static boost::shared_ptr<SystemBackendProc> backend;
std::ifstream uptimeFile;
std::ifstream meminfoFile;
@@ -38,16 +39,16 @@ class SystemBackendProc : private Common::SystemBackend {
SystemBackendProc() : uptimeFile("/proc/uptime"), meminfoFile("/proc/meminfo"), loadFile("/proc/loadavg") {}
protected:
- virtual bool getUptimeInfo(const boost::function2<void, unsigned long, unsigned long> &callback);
- virtual bool getMemoryInfo(const boost::function4<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback);
- virtual bool getLoadInfo(const boost::function5<void, unsigned long, unsigned long, float, float, float> &callback);
+ virtual bool getUptimeInfo(unsigned long *uptime, unsigned long *idleTime);
+ virtual bool getMemoryInfo(unsigned long *totalMem, unsigned long *freeMem, unsigned long *totalSwap, unsigned long *freeSwap);
+ virtual bool getLoadInfo(unsigned long *currentLoad, unsigned long *nProcesses, float *loadAvg1, float *loadAvg5, float *loadAvg15);
public:
static void registerBackend() {
if(backend)
return;
- backend = new SystemBackendProc();
+ backend.reset(new SystemBackendProc());
Common::SystemManager::get()->registerBackend(backend);
}
@@ -56,8 +57,7 @@ class SystemBackendProc : private Common::SystemBackend {
return;
Common::SystemManager::get()->unregisterBackend(backend);
- delete backend;
- backend = 0;
+ backend.reset();
}
};