-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathadv_stdin_channel.cpp
More file actions
55 lines (44 loc) · 959 Bytes
/
Copy pathadv_stdin_channel.cpp
File metadata and controls
55 lines (44 loc) · 959 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
#include "adv_stdin_channel.h"
#include <iostream>
#include "cmd_parse_protocol.h"
using namespace std;
adv_stdin_channel::adv_stdin_channel()
{
}
adv_stdin_channel::~adv_stdin_channel()
{
}
/*返回false的话通道添加到kernel就会失败*/
bool adv_stdin_channel::Init()
{
return true;
}
/*会在数据来临后被调用(epollwait之后被调用)*/
bool adv_stdin_channel::ReadFd(std::string & _input)
{
cin >> _input;
return true;
}
/*会在文件输出缓存区不满的时候调用(大部分时候)*/
bool adv_stdin_channel::WriteFd(std::string & _output)
{
return false;
}
void adv_stdin_channel::Fini()
{
}
/*在通道添加到kernel中时被调用(加epoll)*/
int adv_stdin_channel::GetFd()
{
return 0;
}
std::string adv_stdin_channel::GetChannelInfo()
{
return "stdin_channel";
}
/*调用时机--》数据被读取(ReadFd)后*/
AZinxHandler * adv_stdin_channel::GetInputNextStage(BytesMsg & _oInput)
{
//返回协议对象--》用来处理本通道读取到的数据
return cmd_parse_protocol::GetInstance();
}