00001 00034 #ifndef DAEMON_H 00035 #define DAEMON_H 00036 00037 #include <signal.h> 00038 00039 #include "alarmserverconnector.h" 00040 00041 namespace AlarmNotifications 00042 { 00043 00051 class Daemon 00052 { 00053 private: 00059 static const unsigned short int DaemonSleepTimeout = 3; // seconds 00065 bool _run; 00071 __sighandler_t hsigint; 00077 __sighandler_t hsighup; 00083 __sighandler_t hsigquit; 00089 __sighandler_t hsigusr1; 00095 __sighandler_t hsigusr2; 00101 __sighandler_t hsigterm; 00107 AlarmServerConnector _asc; 00108 00118 static void signalReceiver ( int signum ); 00124 Daemon(); 00125 public: 00132 static Daemon& instance(); 00138 ~Daemon(); 00145 Daemon ( const Daemon& other ) = delete; 00152 Daemon ( Daemon&& other ) = delete; 00160 Daemon& operator= ( const Daemon& other ) = delete; 00168 Daemon& operator= ( Daemon&& other ) = delete; 00175 void run(); 00176 }; 00177 00178 } 00179 00180 #endif // DAEMON_H