summaryrefslogtreecommitdiffstats
path: root/src/modules/SystemBackendProc/SystemBackendProc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/SystemBackendProc/SystemBackendProc.h')
-rw-r--r--src/modules/SystemBackendProc/SystemBackendProc.h32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/modules/SystemBackendProc/SystemBackendProc.h b/src/modules/SystemBackendProc/SystemBackendProc.h
index 9a0cb71..a54d783 100644
--- a/src/modules/SystemBackendProc/SystemBackendProc.h
+++ b/src/modules/SystemBackendProc/SystemBackendProc.h
@@ -17,51 +17,37 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef MAD_MODULES_SYSTEMBACKENDPROC_H_
-#define MAD_MODULES_SYSTEMBACKENDPROC_H_
+#ifndef MAD_MODULES_SYSTEMBACKENDPROC_SYSTEMBACKENDPROC_H_
+#define MAD_MODULES_SYSTEMBACKENDPROC_SYSTEMBACKENDPROC_H_
#include <Common/SystemBackend.h>
+#include <Common/Application.h>
#include <fstream>
-#include <boost/noncopyable.hpp>
namespace Mad {
namespace Modules {
+namespace SystemBackendProc {
-class SystemBackendProc : public Common::SystemBackend, boost::noncopyable {
+class SystemBackendProc : public Common::SystemBackend {
private:
- static boost::shared_ptr<SystemBackendProc> backend;
+ Common::Application *application;
std::ifstream uptimeFile;
std::ifstream meminfoFile;
std::ifstream loadFile;
- SystemBackendProc() : uptimeFile("/proc/uptime"), meminfoFile("/proc/meminfo"), loadFile("/proc/loadavg") {}
-
protected:
virtual void getUptimeInfo(unsigned long *uptime, unsigned long *idleTime) throw(Core::Exception);
virtual void getMemoryInfo(unsigned long *totalMem, unsigned long *freeMem, unsigned long *totalSwap, unsigned long *freeSwap) throw(Core::Exception);
virtual void getLoadInfo(unsigned long *currentLoad, unsigned long *nProcesses, float *loadAvg1, float *loadAvg5, float *loadAvg15) throw(Core::Exception);
public:
- static void registerBackend() {
- if(backend)
- return;
-
- backend.reset(new SystemBackendProc());
- Common::SystemManager::get()->registerBackend(backend);
- }
-
- static void unregisterBackend() {
- if(!backend)
- return;
-
- Common::SystemManager::get()->unregisterBackend(backend);
- backend.reset();
- }
+ SystemBackendProc(Common::Application *application0) : application(application0), uptimeFile("/proc/uptime"), meminfoFile("/proc/meminfo"), loadFile("/proc/loadavg") {}
};
}
}
+}
-#endif /* MAD_MODULES_SYSTEMBACKENDPROC_H_ */
+#endif /* MAD_MODULES_SYSTEMBACKENDPROC_SYSTEMBACKENDPROC_H_ */