statisitcs.h
1.2 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
#pragma once
#include <common.h>
#include "client_proto_head.h"
#undef BIND_PROTO_CMD
#undef BIND_PROTO_CMD_NO_CB
#define BIND_PROTO_CMD(__cmd_id__, fun_name, proto_name)\
static const CMD_ID cli_##proto_name##_cmd = __cmd_id__
#define BIND_PROTO_CMD_NO_CB(__cmd_id__, fun_name, proto_name)
#include <statisitcs_cmd.h>
#undef BIND_PROTO_CMD
#undef BIND_PROTO_CMD_NO_CB
#define STATISITCS_MSG_HANDLE_FUN_PAR el::lib_tcp_peer_info_t* fd_info, google::protobuf::Message* msg
DEF_MSG_HANDLE_FUN(statisitcs_t, STATISITCS)
class statisitcs_t
{
public:
statisitcs_t();
virtual ~statisitcs_t();
int init();
private:
void release();
int init_msg_map();
void release_msg_map();
//binding processing function
#undef BIND_PROTO_CMD
#undef BIND_PROTO_CMD_NO_CB
#define BIND_PROTO_CMD(__cmd_id__, fun_name, proto_name)\
int fun_name(STATISITCS_MSG_HANDLE_FUN_PAR)
#define BIND_PROTO_CMD_NO_CB(__cmd_id__, fun_name, proto_name)\
int fun_name(STATISITCS_MSG_HANDLE_FUN_PAR)
#include <statisitcs_cmd.h>
#undef BIND_PROTO_CMD
#undef BIND_PROTO_CMD_NO_CB
public:
int on_recv(el::lib_tcp_peer_info_t* peer_fd_info, char* pdata, int len);
STATISITCS_MSG_MAP_T msg_map;
};
extern statisitcs_t* g_statisitcs;