-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommand.cpp
72 lines (58 loc) · 1.2 KB
/
command.cpp
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
#include "command.h"
namespace NSQTOOL
{
CCommand::CCommand(int32_t iCmdType, int32_t iCmdId)
:m_iCmdType(iCmdType), m_iCmdId(iCmdId), m_pLData(NULL), m_pRData(NULL)
{
gettimeofday(&m_cTimeBegin, NULL);
}
//不负责释放
CCommand::~CCommand()
{
}
void CCommand::SetCmdType(int32_t iCmdType)
{
m_iCmdType = iCmdType;
}
void CCommand::SetLData(void *pData)
{
m_pLData = pData;
}
void CCommand::SetRData(void *pData)
{
m_pRData = pData;
}
void *CCommand::GetLData()
{
return m_pLData;
}
void *CCommand::GetRData()
{
return m_pRData;
}
int32_t CCommand::GetCmdType()
{
return m_iCmdType;
}
int32_t CCommand::GetCmdId()
{
return m_iCmdId;
}
CCmdAddr &CCommand::GetAddr()
{
return m_cAddr;
}
void CCommand::SetAddr(CCmdAddr &cCmdAddr)
{
m_cAddr = cCmdAddr;
}
int CCommand::CheckTimeout()
{
int64_t iProcessTimeMs = GetIntervalNow(&m_cTimeBegin);
if (iProcessTimeMs > g_iCmdProcessTime)
{
return 0;
}
return -1;
}
};