forked from jimingmin/frame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frame_impl.h
135 lines (109 loc) · 2.02 KB
/
frame_impl.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
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
/*
* frame_impl.h
*
* Created on: 2014年1月22日
* Author: jimm
*/
#ifndef FRAME_IMPL_H_
#define FRAME_IMPL_H_
#include "common/common_object.h"
#include "common/common_typedef.h"
#include "common/common_export.h"
#include "netevent/net_handler.h"
#include "frame_namespace.h"
using namespace NETEVENT;
FRAME_NAMESPACE_BEGIN
class EXPORT IInitFrame
{
public:
IInitFrame(){};
virtual ~IInitFrame(){};
virtual int32_t InitFrame(CNetHandler *pNetHandler) = 0;
};
class EXPORT IConfig : public CBaseObject
{
public:
IConfig(){};
virtual ~IConfig(){};
//初始化配置
virtual int32_t Init() = 0;
//卸载配置
virtual int32_t Uninit() = 0;
virtual int32_t GetSize()
{
return 0;
}
virtual bool IsSafe()
{
return false;
}
virtual int32_t Parser(char *pXMLString)
{
return 0;
}
};
class EXPORT IBank : public CBaseObject
{
public:
IBank(){};
virtual ~IBank(){};
//初始化
virtual int32_t Init() = 0;
//卸载
virtual int32_t Uninit() = 0;
virtual int32_t GetSize()
{
return 0;
}
};
class IMsg : public CBaseObject
{
public:
virtual ~IMsg(){};
virtual int32_t Init()
{
return 0;
}
virtual int32_t Uninit()
{
return 0;
}
virtual int32_t GetSize()
{
return 0;
}
//virtual int32_t Encode(Value &value, Document::AllocatorType& allocator) = 0;
virtual int32_t Encode(uint8_t *pBuf, const int32_t nBufSize, uint32_t &nOffset) = 0;
virtual int32_t Decode(const uint8_t *pBuf, const int32_t nBufSize, uint32_t &nOffset) = 0;
virtual void Dump(char* buf, const uint32_t size, uint32_t& offset) = 0;
};
typedef IMsg IMsgHead;
typedef IMsg IMsgBody;
typedef IMsg ICtlHead;
class IRedisReplyHandler : public CBaseObject
{
public:
IRedisReplyHandler()
{
Init();
}
virtual ~IRedisReplyHandler()
{
Uninit();
}
virtual int32_t Init()
{
return 0;
}
virtual int32_t Uninit()
{
return 0;
}
virtual int32_t GetSize()
{
return 0;
}
virtual int32_t OnRedisReply(int32_t nResult, void *pReply, CBaseObject *pParam) = 0;
};
FRAME_NAMESPACE_END
#endif /* FRAME_IMPL_H_ */