1 |
#ifndef __COMMON_H__ |
2 |
#define __COMMON_H__ |
3 |
|
4 |
#include <string> |
5 |
|
6 |
|
7 |
//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 |
//Singleton |
20 |
class Common |
21 |
{ |
22 |
public: |
23 |
static Common* instance(); |
24 |
|
25 |
bool isDaemon; |
26 |
bool isDebug; |
27 |
int uid; |
28 |
int gid; |
29 |
volatile bool mainContinue; |
30 |
|
31 |
std::string configFilePath; |
32 |
|
33 |
std::string pidfile; |
34 |
std::string spooldir; |
35 |
|
36 |
long int daemonStart; |
37 |
|
38 |
SmsCounter smsCounter; |
39 |
|
40 |
class PluginManager* GetPluginManager(); |
41 |
class TaskManager* GetTaskManager(); |
42 |
class ConfigFile* GetConfigfile(); |
43 |
void SetConfigfile(class ConfigFile*); |
44 |
|
45 |
void logMessage(std::string str); |
46 |
void setLogfile(std::string file) {_logFile = file;} |
47 |
|
48 |
void loadConfig(int argc, char* argv[]); |
49 |
|
50 |
std::string getStatusMessage(); |
51 |
private: |
52 |
Common(); |
53 |
Common(const Common&) {} |
54 |
Common& operator=(const Common) {return *this;} |
55 |
~Common(); |
56 |
|
57 |
|
58 |
|
59 |
class PluginManager* _pluginManager; |
60 |
class TaskManager* _taskManager; |
61 |
class ConfigFile* _configFile; |
62 |
|
63 |
void printUsage(); |
64 |
|
65 |
std::string _logFile; |
66 |
}; |
67 |
|
68 |
|
69 |
#endif //__COMMON_H__ |