-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOuterFactoryImp.h
More file actions
136 lines (113 loc) · 2.74 KB
/
OuterFactoryImp.h
File metadata and controls
136 lines (113 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef _OUTER_FACTORY_IMP_H_
#define _OUTER_FACTORY_IMP_H_
#include <string>
#include <map>
#include "globe.h"
#include "servant/Application.h"
#include "OuterFactory.h"
//wbl
#include <wbl/regex_util.h>
#include <wbl/stream_util.h>
//db config
typedef struct _TDBConfig
{
string Domain; //域名
string strDBHost; //主机IP
string strDBUser; //DB用户名
string strDBPwd; //DB密码
string strDBName; //DB名字
string strDBCharSet; //表的字符集
int iDBPort; //DB监听端口
} DBConfig;
//log config
typedef struct _TLogConfigItem
{
string field; //字段名
int type; //字段类型
} TLogConfigItem;
//日志配置
typedef struct _TLogConfig
{
DBConfig dbConfig; //数据库配置
string tablename; //表名
vector<TLogConfigItem> vecLogConfigItems; //字段
} TLogConfig;
//
class OuterFactoryImp;
typedef TC_AutoPtr<OuterFactoryImp> OuterFactoryImpPtr;
//
// using namespace DaqiGame;
/**
* 外部工具接口对象工厂
*/
class OuterFactoryImp : public OuterFactory
{
private:
/**
*
*/
OuterFactoryImp();
/**
*
*/
~OuterFactoryImp();
//
friend class Log2DBServantImp;
friend class Log2DBServer;
public:
//框架中用到的outer接口(不能修改):
const OuterProxyFactoryPtr &getProxyFactory() const
{
return _pProxyFactory;
}
tars::TC_Config &getConfig() const
{
return *_pFileConf;
}
public:
//加载配置
bool reloadConfig();
//
bool reloadConfig(const std::string &cmd, std::string &des);
//读取所有配置
void load();
//db配置
void readDBConfig();
//打印db配置
void printDBConfig();
//取db配置
DBConfig &getDBConfig();
//log配置
void readLogConfig();
//打印log配置
void printLogConfig();
//取log配置
const map<int, TLogConfig> &getLogConfig();
//根据序号取log配置
int getLogConfigByID(int id, TLogConfig &tLogConfig);
private:
//
void createAllObject();
//
void deleteAllObject();
public:
//格式化时间
string GetTLogTimeFormat();
private:
//拆分字符串成整形
int splitInt(string szSrc, vector<int> &vecInt);
private:
//
wbl::ReadWriteLocker m_rwlock;
//框架用到的共享对象(不能修改):
tars::TC_Config *_pFileConf;
//
OuterProxyFactoryPtr _pProxyFactory;
//db config
DBConfig dbConfig;
public:
//日志配置
map<int, TLogConfig> mapLogConfig;
};
////////////////////////////////////////////////////////////////////////////////
#endif