blob: 6060fb1ddfa2b898821c26815a2710e395d5194a (
plain)
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
|
// $Id$
#include "Protocol_Task.h"
#include "ace/ACE.h"
// Construct the object and remember the thread count.
Protocol_Task::Protocol_Task(void)
{
;
}
Protocol_Task::~Protocol_Task(void)
{
;
}
int Protocol_Task::open(void *arg)
{
ACE_UNUSED_ARG(arg);
return(0);
}
int Protocol_Task::close(u_long flags)
{
ACE_UNUSED_ARG(flags);
return 0;
}
/* When a message is put() onto the task, it's time to process() some data.
*/
int Protocol_Task::put(ACE_Message_Block *message,ACE_Time_Value *timeout)
{
return this->process(message,timeout);
}
/* Return an error since we don't want the task to ever be activated.
*/
int Protocol_Task::svc(void)
{
return -1;
}
/* There's nothing really magic about process(). We just decide if
we're moving data upstream or downstream and invoke the appropriate
virtual function to handle it.
*/
int Protocol_Task::process(ACE_Message_Block * message, ACE_Time_Value *timeout)
{
if( this->is_writer() )
{
return this->send(message,timeout);
}
return this->recv(message,timeout);
}
/* We must insist that derivatives provide a meaningful overload for
these methods. It's fairly common for ACE object methods to return
an error when an overload is expected but the method cannot be
safely made pure virtual.
*/
int Protocol_Task::send(ACE_Message_Block *message,
ACE_Time_Value *timeout)
{
ACE_UNUSED_ARG(message);
ACE_UNUSED_ARG(timeout);
return -1;
}
int Protocol_Task::recv(ACE_Message_Block * message,
ACE_Time_Value *timeout)
{
ACE_UNUSED_ARG(message);
ACE_UNUSED_ARG(timeout);
return -1;
}
|