/[projects]/smsdaemon/Common.h
ViewVC logotype

Annotation of /smsdaemon/Common.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 150 - (hide annotations) (download)
Sun Dec 7 21:42:15 2008 UTC (15 years, 5 months ago) by torben
Original Path: smsdaemon/common.h
File MIME type: text/plain
File size: 1151 byte(s)
Make daemon mode a chance to dump error messages to console before daemonizing

1 torben 26 #ifndef __COMMON_H__
2     #define __COMMON_H__
3    
4     #include <string>
5    
6    
7 torben 36 //time_t is defines as long int ! //No need to include time.h
8    
9     class SmsCounter
10     {
11     public:
12     SmsCounter() : incomming(0), outgoing(0) {}
13    
14     unsigned int incomming;
15     unsigned int outgoing;
16     };
17    
18    
19 torben 26 //Singleton
20     class Common
21     {
22     public:
23     static Common* instance();
24    
25     bool isDaemon;
26     bool isDebug;
27 torben 150 bool daemonized;
28 torben 26 int uid;
29     int gid;
30     volatile bool mainContinue;
31    
32 torben 146 std::string configFilePath;
33    
34 torben 26 std::string pidfile;
35     std::string spooldir;
36    
37 torben 36 long int daemonStart;
38 torben 26
39 torben 36 SmsCounter smsCounter;
40 torben 26
41 torben 92 class PluginManager* GetPluginManager();
42     class TaskManager* GetTaskManager();
43 torben 146 class ConfigFile* GetConfigfile();
44     void SetConfigfile(class ConfigFile*);
45 torben 92
46 torben 26 void logMessage(std::string str);
47     void setLogfile(std::string file) {_logFile = file;}
48    
49     void loadConfig(int argc, char* argv[]);
50    
51 torben 36 std::string getStatusMessage();
52 torben 26 private:
53 torben 92 Common();
54 torben 26 Common(const Common&) {}
55     Common& operator=(const Common) {return *this;}
56 torben 92 ~Common();
57 torben 26
58 torben 92
59    
60     class PluginManager* _pluginManager;
61     class TaskManager* _taskManager;
62 torben 146 class ConfigFile* _configFile;
63 torben 92
64 torben 26 void printUsage();
65    
66     std::string _logFile;
67     };
68    
69    
70     #endif //__COMMON_H__

  ViewVC Help
Powered by ViewVC 1.1.20