-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_mgt.h
71 lines (50 loc) · 1.32 KB
/
data_mgt.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* data_mgt.h
*
* Created on: 2013年9月10日
* Author: 1854
*/
#ifndef DATA_MGT_H_
#define DATA_MGT_H_
#include "server_namespace.h"
#include "common/common_object.h"
#include "common/common_singleton.h"
#include "player.h"
#include "lightframe_impl.h"
#include <list>
using namespace std;
FRAME_ROBOT_NAMESPACE_BEGIN
#define g_PlayerMgt CSingleton<ObjectPool<CPlayer, 1000> >::GetInstance()
typedef list<CPlayer *> PlayerList;
typedef uint8_t CounterType;
enum
{
enmCounterType_ConnectTimeout = 0x00,
enmCounterType_LoginTimeout = 0x01,
};
class CDataMgt : public CObject, public ITimerEvent
{
public:
CDataMgt()
{
m_nConnectTimeoutCount = 0;
m_nLoginTimeoutCount = 0;
}
virtual ~CDataMgt(){};
int32_t Initialize();
int32_t Resume();
int32_t Uninitialize();
int32_t OnTimerEvent(CFrameTimer *pTimer);
PlayerList &GetPlayerList();
void PushPlayer(CPlayer *pPlayer);
CPlayer *PopPlayer();
void DelPlayer(CPlayer *pPlayer);
void IncCounter(CounterType nType);
protected:
PlayerList m_stPlayerList;
uint32_t m_nConnectTimeoutCount; //连接服务器超时的数量
uint32_t m_nLoginTimeoutCount; //登陆游戏超时的数量
};
#define g_DataMgt CSingleton<CDataMgt>::GetInstance()
FRAME_ROBOT_NAMESPACE_END
#endif /* DATA_MGT_H_ */