summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-05-18 19:53:51 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-05-18 19:53:51 +0200
commitfc3c50063f659584b2145addab8236a479a031b7 (patch)
tree0aa7057cb9fa7523ace98e0776d46609de58954e /src/modules
parenta3e566c4d3631076e29f3651554603184b6351a7 (diff)
downloadmad-fc3c50063f659584b2145addab8236a479a031b7.tar
mad-fc3c50063f659584b2145addab8236a479a031b7.zip
Von sigc++ auf boost-signals migriert
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/Makefile.in8
-rw-r--r--src/modules/SystemBackendPosix.cpp30
-rw-r--r--src/modules/SystemBackendPosix.h22
-rw-r--r--src/modules/SystemBackendProc.cpp14
-rw-r--r--src/modules/SystemBackendProc.h6
-rw-r--r--src/modules/UserBackendMysql.cpp12
-rw-r--r--src/modules/UserBackendMysql.h4
7 files changed, 48 insertions, 48 deletions
diff --git a/src/modules/Makefile.in b/src/modules/Makefile.in
index 077c7bb..8dc9810 100644
--- a/src/modules/Makefile.in
+++ b/src/modules/Makefile.in
@@ -42,6 +42,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_boost_base.m4 \
+ $(top_srcdir)/m4/ax_boost_signals.m4 \
$(top_srcdir)/m4/ax_boost_thread.m4 \
$(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
@@ -68,8 +69,7 @@ FileLogger_la_OBJECTS = $(am_FileLogger_la_OBJECTS)
FileLogger_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(FileLogger_la_LDFLAGS) $(LDFLAGS) -o $@
-am__DEPENDENCIES_1 =
-SystemBackendPosix_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+SystemBackendPosix_la_DEPENDENCIES =
am_SystemBackendPosix_la_OBJECTS = SystemBackendPosix.lo
SystemBackendPosix_la_OBJECTS = $(am_SystemBackendPosix_la_OBJECTS)
SystemBackendPosix_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
@@ -83,6 +83,7 @@ SystemBackendProc_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(SystemBackendProc_la_LDFLAGS) $(LDFLAGS) -o $@
@SYSTEMBACKEND_PROC_TRUE@am_SystemBackendProc_la_rpath =
+am__DEPENDENCIES_1 =
UserBackendMysql_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
am_UserBackendMysql_la_OBJECTS = UserBackendMysql.lo
@@ -123,6 +124,7 @@ AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
BOOST_LDFLAGS = @BOOST_LDFLAGS@
+BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@
BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
@@ -254,8 +256,6 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-sigc_CFLAGS = @sigc_CFLAGS@
-sigc_LIBS = @sigc_LIBS@
srcdir = @srcdir@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
diff --git a/src/modules/SystemBackendPosix.cpp b/src/modules/SystemBackendPosix.cpp
index 21e5c75..4969c6d 100644
--- a/src/modules/SystemBackendPosix.cpp
+++ b/src/modules/SystemBackendPosix.cpp
@@ -33,8 +33,6 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <sigc++/bind.h>
-
#define init SystemBackendPosix_LTX_init
#define deinit SystemBackendPosix_LTX_deinit
@@ -43,8 +41,8 @@ namespace Modules {
SystemBackendPosix *SystemBackendPosix::backend = 0;
-std::map<pid_t, sigc::slot<void, int> > SystemBackendPosix::processes;
-std::map<pid_t, sigc::slot<void, int, const std::string&> > SystemBackendPosix::processesWithOutput;
+std::map<pid_t, boost::function1<void, int> > SystemBackendPosix::processes;
+std::map<pid_t, boost::function2<void, int, const std::string&> > SystemBackendPosix::processesWithOutput;
std::map<pid_t, int> SystemBackendPosix::processesWOHandles;
std::map<pid_t, std::string > SystemBackendPosix::processesWOOutput;
@@ -70,7 +68,7 @@ SystemBackendPosix::~SystemBackendPosix() {
}
-void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) {
+void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const boost::function1<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) {
std::vector<Common::SystemManager::FSInfo> ret;
std::istringstream stream(output);
std::string str;
@@ -99,14 +97,14 @@ void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const si
callback(ret);
}
-bool SystemBackendPosix::getFSInfo(const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) {
+bool SystemBackendPosix::getFSInfo(const boost::function1<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) {
std::vector<std::string> argv;
argv.push_back("/bin/df");
argv.push_back("-P");
argv.push_back("-k");
- return execWithOutput(sigc::bind(sigc::mem_fun(this, &SystemBackendPosix::fsInfoCallback), callback), "/bin/df", argv);
+ return execWithOutput(boost::bind(&SystemBackendPosix::fsInfoCallback, this, _1, _2, callback), "/bin/df", argv);
}
@@ -115,14 +113,14 @@ void SystemBackendPosix::childHandler(int) {
pid_t pid;
while((pid = waitpid(-1, &status, WNOHANG)) > 0) {
- std::map<pid_t, sigc::slot<void, int> >::iterator it = processes.find(pid);
+ std::map<pid_t, boost::function1<void, int> >::iterator it = processes.find(pid);
if(it != processes.end()) {
- Common::ActionManager::get()->add(sigc::bind(it->second, status));
+ Common::ActionManager::get()->add(boost::bind(it->second, status));
processes.erase(it);
}
else {
- std::map<pid_t, sigc::slot<void, int, const std::string&> >::iterator it2 = processesWithOutput.find(pid);
+ std::map<pid_t, boost::function2<void, int, const std::string&> >::iterator it2 = processesWithOutput.find(pid);
if(it2 != processesWithOutput.end()) {
char buffer[1024];
@@ -133,10 +131,10 @@ void SystemBackendPosix::childHandler(int) {
while((n = read(handle, buffer, sizeof(buffer))) > 0)
output += std::string(buffer, n);
- Net::FdManager::get()->unregisterFd(handle);
- close(handle);
+ //Net::FdManager::get()->unregisterFd(handle);
+ //close(handle);
- Common::ActionManager::get()->add(sigc::bind(it2->second, status, output));
+ //Common::ActionManager::get()->add(boost::bind(it2->second, status, output));
processesWithOutput.erase(it2);
processesWOHandles.erase(pid);
processesWOOutput.erase(pid);
@@ -218,7 +216,7 @@ void SystemBackendPosix::destroyArgs(std::pair<char**, char**> args) {
}
}
-bool SystemBackendPosix::exec(const sigc::slot<void, int> &resultHandler, const std::string &filename, const std::vector<std::string> &argv, const std::vector<std::string> &env) {
+bool SystemBackendPosix::exec(const boost::function1<void, int> &resultHandler, const std::string &filename, const std::vector<std::string> &argv, const std::vector<std::string> &env) {
pid_t pid;
std::pair<char**, char**> args = makeArgs(filename, argv, env);
@@ -239,7 +237,7 @@ bool SystemBackendPosix::exec(const sigc::slot<void, int> &resultHandler, const
return ret;
}
-bool SystemBackendPosix::execWithOutput(const sigc::slot<void, int, const std::string&> &resultHandler, const std::string &filename, const std::vector<std::string> &argv, const std::vector<std::string> &env) {
+bool SystemBackendPosix::execWithOutput(const boost::function2<void, int, const std::string&> &resultHandler, const std::string &filename, const std::vector<std::string> &argv, const std::vector<std::string> &env) {
pid_t pid;
std::pair<char**, char**> args = makeArgs(filename, argv, env);
@@ -268,7 +266,7 @@ bool SystemBackendPosix::execWithOutput(const sigc::slot<void, int, const std::s
processesWOHandles.insert(std::make_pair(pid, pipeHandles[0]));
processesWOOutput.insert(std::make_pair(pid, std::string()));
- Net::FdManager::get()->registerFd(pipeHandles[0], sigc::bind(sigc::ptr_fun(&SystemBackendPosix::outputHandler), pid), POLLIN);
+ Net::FdManager::get()->registerFd(pipeHandles[0], boost::bind(&SystemBackendPosix::outputHandler, _1, pid), POLLIN);
}
dup2(saveStdout, STDOUT_FILENO); // restore old stdout
diff --git a/src/modules/SystemBackendPosix.h b/src/modules/SystemBackendPosix.h
index b12af6b..6d9b65f 100644
--- a/src/modules/SystemBackendPosix.h
+++ b/src/modules/SystemBackendPosix.h
@@ -27,18 +27,20 @@
#include <vector>
#include <sys/types.h>
-#include <sigc++/slot.h>
-#include <sigc++/adaptors/hide.h>
+
+#include <boost/bind.hpp>
namespace Mad {
namespace Modules {
+// TODO SystemBackendPosix doesn't work !!!
+
class SystemBackendPosix : private Common::SystemBackend {
private:
static SystemBackendPosix *backend;
- static std::map<pid_t, sigc::slot<void, int> > processes;
+ static std::map<pid_t, boost::function1<void, int> > processes;
- static std::map<pid_t, sigc::slot<void, int, const std::string&> > processesWithOutput;
+ static std::map<pid_t, boost::function2<void, int, const std::string&> > processesWithOutput;
static std::map<pid_t, int> processesWOHandles;
static std::map<pid_t, std::string > processesWOOutput;
@@ -55,13 +57,13 @@ class SystemBackendPosix : private Common::SystemBackend {
setChildHandler();
}
- void fsInfoCallback(int, const std::string &output, const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback);
+ void fsInfoCallback(int, const std::string &output, const boost::function1<void, const std::vector<Common::SystemManager::FSInfo>& > &callback);
protected:
- virtual bool getFSInfo(const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback);
+ virtual bool getFSInfo(const boost::function1<void, const std::vector<Common::SystemManager::FSInfo>& > &callback);
- virtual bool shutdown(const sigc::slot<void> &callback) {return exec(sigc::hide(callback), "/sbin/halt");}
- virtual bool reboot(const sigc::slot<void> &callback) {return exec(sigc::hide(callback), "/sbin/reboot");}
+ virtual bool shutdown(const boost::function0<void> &callback) {return exec(boost::bind(callback), "/sbin/halt");}
+ virtual bool reboot(const boost::function0<void> &callback) {return exec(boost::bind(callback), "/sbin/reboot");}
public:
~SystemBackendPosix();
@@ -83,10 +85,10 @@ class SystemBackendPosix : private Common::SystemBackend {
backend = 0;
}
- static bool exec(const sigc::slot<void, int> &resultHandler, const std::string &filename, const std::vector<std::string> &argv = std::vector<std::string>(),
+ static bool exec(const boost::function1<void, int> &resultHandler, const std::string &filename, const std::vector<std::string> &argv = std::vector<std::string>(),
const std::vector<std::string> &env = std::vector<std::string>());
- static bool execWithOutput(const sigc::slot<void, int, const std::string&> &resultHandler, const std::string &filename, const std::vector<std::string> &argv = std::vector<std::string>(),
+ static bool execWithOutput(const boost::function2<void, int, const std::string&> &resultHandler, const std::string &filename, const std::vector<std::string> &argv = std::vector<std::string>(),
const std::vector<std::string> &env = std::vector<std::string>());
};
diff --git a/src/modules/SystemBackendProc.cpp b/src/modules/SystemBackendProc.cpp
index 501f779..68f9cec 100644
--- a/src/modules/SystemBackendProc.cpp
+++ b/src/modules/SystemBackendProc.cpp
@@ -24,7 +24,7 @@
#include <cstdio>
#include <cstring>
-#include <sigc++/bind.h>
+#include <boost/bind.hpp>
#define init SystemBackendProc_LTX_init
#define deinit SystemBackendProc_LTX_deinit
@@ -34,7 +34,7 @@ namespace Modules {
SystemBackendProc *SystemBackendProc::backend = 0;
-bool SystemBackendProc::getUptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback) {
+bool SystemBackendProc::getUptimeInfo(const boost::function2<void, unsigned long, unsigned long> &callback) {
unsigned long uptime = 0, idleTime = 0;
uptimeFile.seekg(0, std::ios::beg);
@@ -53,12 +53,12 @@ bool SystemBackendProc::getUptimeInfo(const sigc::slot<void, unsigned long, unsi
if(uptimeFile.good())
idleTime = (unsigned long)f;
- Common::ActionManager::get()->add(sigc::bind(callback, uptime, idleTime));
+ Common::ActionManager::get()->add(boost::bind(callback, uptime, idleTime));
return true;
}
-bool SystemBackendProc::getMemoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback) {
+bool SystemBackendProc::getMemoryInfo(const boost::function4<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback) {
unsigned long totalMem = 0, freeMem = 0, totalSwap = 0, freeSwap = 0;
meminfoFile.seekg(0, std::ios::beg);
@@ -90,12 +90,12 @@ bool SystemBackendProc::getMemoryInfo(const sigc::slot<void, unsigned long, unsi
break;
}
- Common::ActionManager::get()->add(sigc::bind(callback, totalMem, freeMem, totalSwap, freeSwap));
+ Common::ActionManager::get()->add(boost::bind(callback, totalMem, freeMem, totalSwap, freeSwap));
return true;
}
-bool SystemBackendProc::getLoadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback) {
+bool SystemBackendProc::getLoadInfo(const boost::function5<void, unsigned long, unsigned long, float, float, float> &callback) {
unsigned long currentLoad = 0, nProcesses = 0;
float loadAvg1 = 0, loadAvg5 = 0, loadAvg15 = 0;
@@ -112,7 +112,7 @@ bool SystemBackendProc::getLoadInfo(const sigc::slot<void, unsigned long, unsign
std::sscanf(line.c_str(), "%f %f %f %lu/%lu", &loadAvg1, &loadAvg5, &loadAvg15, &currentLoad, &nProcesses);
- Common::ActionManager::get()->add(sigc::bind(callback, currentLoad, nProcesses, loadAvg1, loadAvg5, loadAvg15));
+ Common::ActionManager::get()->add(boost::bind(callback, currentLoad, nProcesses, loadAvg1, loadAvg5, loadAvg15));
return true;
}
diff --git a/src/modules/SystemBackendProc.h b/src/modules/SystemBackendProc.h
index 7174551..bf19e22 100644
--- a/src/modules/SystemBackendProc.h
+++ b/src/modules/SystemBackendProc.h
@@ -38,9 +38,9 @@ class SystemBackendProc : private Common::SystemBackend {
SystemBackendProc() : uptimeFile("/proc/uptime"), meminfoFile("/proc/meminfo"), loadFile("/proc/loadavg") {}
protected:
- virtual bool getUptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback);
- virtual bool getMemoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback);
- virtual bool getLoadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback);
+ 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);
public:
static void registerBackend() {
diff --git a/src/modules/UserBackendMysql.cpp b/src/modules/UserBackendMysql.cpp
index daea626..da5126a 100644
--- a/src/modules/UserBackendMysql.cpp
+++ b/src/modules/UserBackendMysql.cpp
@@ -27,7 +27,7 @@
#include <sstream>
-#include <sigc++/bind.h>
+#include <boost/bind.hpp>
#include <pcrecpp.h>
#define init UserBackendMysql_LTX_init
@@ -135,7 +135,7 @@ void UserBackendMysql::configFinished() {
}
-bool UserBackendMysql::getUserList(const sigc::slot<void, const std::map<unsigned long, Common::UserInfo>& > &callback) {
+bool UserBackendMysql::getUserList(const boost::function1<void, const std::map<unsigned long, Common::UserInfo>& > &callback) {
mysql_ping(mysql);
mysql_real_query(mysql, queryListUsers.c_str(), queryListUsers.length());
@@ -155,12 +155,12 @@ bool UserBackendMysql::getUserList(const sigc::slot<void, const std::map<unsigne
users.insert(std::make_pair(user.getUid(), user));
}
- Common::ActionManager::get()->add(sigc::bind(callback, users));
+ Common::ActionManager::get()->add(boost::bind(callback, users));
return true;
}
-bool UserBackendMysql::getUserInfo(unsigned long uid, const sigc::slot<void, const Common::UserInfo&> &callback) {
+bool UserBackendMysql::getUserInfo(unsigned long uid, const boost::function1<void, const Common::UserInfo&> &callback) {
mysql_ping(mysql);
std::string query = queryUserById;
@@ -186,12 +186,12 @@ bool UserBackendMysql::getUserInfo(unsigned long uid, const sigc::slot<void, con
user.setGid(strtoul(row[1], 0, 10));
user.setFullName(row[3]);
- Common::ActionManager::get()->add(sigc::bind(callback, user));
+ Common::ActionManager::get()->add(boost::bind(callback, user));
while((row = mysql_fetch_row(result)) != 0) {}
}
else {
- Common::ActionManager::get()->add(sigc::bind(callback, Common::UserInfo()));
+ Common::ActionManager::get()->add(boost::bind(callback, Common::UserInfo()));
}
return true;
diff --git a/src/modules/UserBackendMysql.h b/src/modules/UserBackendMysql.h
index ddd4252..2e4f1ff 100644
--- a/src/modules/UserBackendMysql.h
+++ b/src/modules/UserBackendMysql.h
@@ -50,8 +50,8 @@ class UserBackendMysql : private Server::UserBackend, private Common::Configurab
virtual bool handleConfigEntry(const Common::ConfigEntry &entry, bool);
virtual void configFinished();
- virtual bool getUserList(const sigc::slot<void, const std::map<unsigned long, Common::UserInfo>& > &callback);
- virtual bool getUserInfo(unsigned long uid, const sigc::slot<void, const Common::UserInfo&> &callback);
+ virtual bool getUserList(const boost::function1<void, const std::map<unsigned long, Common::UserInfo>& > &callback);
+ virtual bool getUserInfo(unsigned long uid, const boost::function1<void, const Common::UserInfo&> &callback);
public:
virtual ~UserBackendMysql() {