-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
58 lines (49 loc) · 1.3 KB
/
main.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
#include <zinx.h>
#include "echorole.h"
#include "cmdcheck.h"
#include "stdinout.h"
#include "zinxtimer.h"
class _hello : public timerProc
{
public:
virtual void Proc()
{
auto out = ZinxKernel::Zinx_GetChannel_ByInfo("stdout");
string s = "_hello world";
ZinxKernel::Zinx_SendOut(s, *out);
}
virtual int getTimerSeconds()
{
return 3;
}
};
class __hello : public timerProc
{
public:
virtual void Proc()
{
auto out = ZinxKernel::Zinx_GetChannel_ByInfo("stdout");
string s = "__hello world";
ZinxKernel::Zinx_SendOut(s, *out);
}
virtual int getTimerSeconds()
{
return 5;
}
};
int main()
{
ZinxKernel::ZinxKernelInit();
timermanager::getInstance().addTimerProc(new _hello);
timermanager::getInstance().addTimerProc(new __hello);
ZinxKernel::Zinx_Add_Channel(*(new inputchannel()));
ZinxKernel::Zinx_Add_Channel(*(new outputchannel()));
ZinxKernel::Zinx_Add_Channel(*(new ZinxTCPListen(6666, new mytcpfact)));
ZinxKernel::Zinx_Add_Role(*(new echo()));
ZinxKernel::Zinx_Add_Role(*(new inoutcontrol()));
ZinxKernel::Zinx_Add_Role(*(new dateecho()));
ZinxKernel::Zinx_Add_Channel(*(new zinxtimerchannel));
ZinxKernel::Zinx_Run();
ZinxKernel::ZinxKernelFini();
return 0;
}