}
static ::Server __server;
-static ServiceLoader __loader;
static AlarmInitializer __alarmInit;
static void __signalHandler(int signum)
{
_I(YELLOW("SIGNAL-%d: '%s'"), signum, strsignal(signum));
_I("Unloading services");
- __loader.unload();
+ ServiceLoader::unload();
__server.stop();
}
Timer::setDBusConnection(conn);
_I("Loading services");
- if (__loader.load(conn)) {
+ if (ServiceLoader::load(conn)) {
_I("Service loading successful");
return;
}
static void __busLost(GDBusConnection* conn)
{
_I("Unloading services");
- __loader.unload();
+ ServiceLoader::unload();
__server.stop();
}
using namespace ctx;
-ServiceLoader::ServiceLoader()
-{
-}
-
-ServiceLoader::~ServiceLoader()
-{
- unload();
-}
+std::vector<DBusService*> ServiceLoader::__services;
bool ServiceLoader::load(GDBusConnection* conn)
{
class ServiceLoader {
public:
- ServiceLoader();
- ~ServiceLoader();
-
- bool load(GDBusConnection* conn);
- void unload();
+ static bool load(GDBusConnection* conn);
+ static void unload();
private:
- std::vector<DBusService*> __services;
+ static std::vector<DBusService*> __services;
- template<typename ServiceType> void __load(GDBusConnection* conn)
+ template<typename ServiceType> static void __load(GDBusConnection* conn)
{
DBusService *svc = NULL;
try {