-
Notifications
You must be signed in to change notification settings - Fork 2
/
ExecuteReportQueue.cpp
82 lines (67 loc) · 1.77 KB
/
ExecuteReportQueue.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
73
74
75
76
77
78
79
80
81
82
#include "IPCLockFreeQueue.hpp"
#include "PackMessage.hpp"
class ExecuteReportQueue
{
public:
explicit ExecuteReportQueue(unsigned int ChannelCount, unsigned int IPCKey)
:m_OrderQueue(IPCKey, ChannelCount)
{
}
void Init()
{
m_OrderQueue.Init();
}
void RegisterChannel(const char* account)
{
m_OrderQueue.RegisterChannel(account);
}
void ResetChannel(const char* account)
{
m_OrderQueue.ResetChannel(account);
}
bool Push(const Message::TOrderStatus& message)
{
return m_OrderQueue.Push(message);
}
bool Pop(Message::TOrderStatus& message)
{
return m_OrderQueue.Pop(message);
}
protected:
Utils::IPCLockFreeQueue<Message::TOrderStatus, 1000> m_OrderQueue;
};
extern "C"
{
ExecuteReportQueue* ExecuteReportQueue_New(unsigned int ChannelCount, unsigned int IPCKey)
{
return new ExecuteReportQueue(ChannelCount, IPCKey);
}
void ExecuteReportQueue_Init(ExecuteReportQueue* queue)
{
queue->Init();
}
void ExecuteReportQueue_RegisterChannel(ExecuteReportQueue* queue, const char* account)
{
queue->RegisterChannel(account);
}
void ExecuteReportQueue_ResetChannel(ExecuteReportQueue* queue, const char* account)
{
queue->ResetChannel(account);
}
bool ExecuteReportQueue_Push(ExecuteReportQueue* queue, const Message::TOrderStatus& message)
{
return queue->Push(message);
}
bool ExecuteReportQueue_Pop(ExecuteReportQueue* queue, Message::TOrderStatus& message)
{
return queue->Pop(message);
}
void ExecuteReportQueue_Delete(ExecuteReportQueue* queue)
{
if(queue)
{
delete queue;
queue = NULL;
}
}
};