-
Notifications
You must be signed in to change notification settings - Fork 2
/
gent_app_mgr.h
executable file
·54 lines (48 loc) · 1.15 KB
/
gent_app_mgr.h
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
/*
* gent_app_mgr.h
*
* Created on: 2012-7-7
* Author: wyt
*/
#ifndef GENT_APP_MGR_H_
#define GENT_APP_MGR_H_
#include "prefine.h"
class GentBasic;
class GentCommand;
class GentConnect;
typedef std::map<int,std::vector<GentBasic *> > APP_MODULE;
typedef std::map<int,GentCommand*> PLUGIN;
typedef std::list<GentConnect *> FREE_CONNPOOL;
typedef std::map<int, GentConnect *> CONNPOOL;
class GentAppMgr
{
static GentAppMgr *intance_;
static CommLock lock;
private:
APP_MODULE app_mgr_;
PLUGIN plus_mgr;
unsigned int def_num;
GentCommand *plus;
CONNPOOL conn_mgr;
FREE_CONNPOOL free_conn_mgr;
CommLock conn_lock;
size_t total_conn;
public:
static GentAppMgr *Instance();
static void UnInstance();
public:
GentAppMgr();
~GentAppMgr();
int Register(int cmd, GentBasic *app);
int GetModule(int cmd,GentBasic *&);
int SetModule(int cmd, GentBasic *&app);
GentConnect *GetConnect(int sfd);
void RetConnect(GentConnect *);
size_t GetConnCount();
size_t GetTotalConnCount();
bool Init();
void SetPlugin(GentCommand *command);
GentCommand *GetCommand(GentConnect *, int id);
void Destroy(int id);
};
#endif /* GENT_APP_MGR_H_ */