-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathasyntabworker.cpp
More file actions
63 lines (57 loc) · 987 Bytes
/
asyntabworker.cpp
File metadata and controls
63 lines (57 loc) · 987 Bytes
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
#ifndef _MASYNTABWORKER_CPP
#define _MASYNTABWORKER_CPP
#include "asyntabworker.h"
AsyntabWorker::AsyntabWorker()
:m_send(NULL),m_billtype("")
{
}
AsyntabWorker::~AsyntabWorker()
{
}
xpipe * AsyntabWorker::get_send_pipe()
{
return m_send;
}
void AsyntabWorker::set_send_pipe(xpipe &xpipe)
{
m_send=&xpipe;
}
xpipe * AsyntabWorker::get_recv_pipe()
{
return m_recv;
}
void AsyntabWorker::set_recv_pipe(xpipe &xpipe)
{
m_recv=&xpipe;
}
string AsyntabWorker::get_billtype()
{
return m_billtype;
}
void AsyntabWorker::set_billtype(const string &type)
{
m_billtype=type;
}
void AsyntabWorker::run()
{
struct REC
{
char billtype[32];
long recid;
}rec;
while (true){
m_send->send("OK");
m_recv->recv(&rec,sizeof(struct REC));
if (strcmp(rec.billtype,"END")==0){
exit(0);
}
m_billtype=rec.billtype;
if (m_billtype == "PAYBY"){
cout<<"PAYBY:doing job-"<<rec.recid<<endl;
}
else {
cout<<m_billtype<<":doing job-"<<rec.recid<<endl;
}
}
}
#endif