blob: 8f95390f898e50b4c049939e5d6944bb04928373 (
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
// $Id$
// ============================================================================
//
// = LIBRARY
// TAO/examples/AMI/FL_Callback
//
// = FILENAME
// Peer_i.h
//
// = AUTHOR
// Carlos O'Ryan
//
// ============================================================================
#ifndef PEER_I_H
#define PEER_I_H
#include "testS.h"
#include "ace/Task.h"
class Peer_i;
class Peer_Handler_i : public POA_AMI_PeerHandler
{
public:
Peer_Handler_i (Peer_i *peer);
// The peer
virtual void request (CORBA::Long retval
TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
virtual void request_excep (AMI_PeerExceptionHolder * excep_holder
TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
virtual void start (TAO_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
virtual void shutdown (TAO_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
private:
Peer_i *peer_;
// The real implementation
};
class Peer_i : public POA_Peer
{
public:
Peer_i (void);
// Constructor
virtual ~Peer_i (void);
// Destructor
void init (CORBA::ORB_ptr orb,
Progress_ptr progress,
const ACE_Time_Value &delay
TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
void reply (CORBA::Long result
TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
// Used by the Reply_Handler to indicate that a reply has been
// received.
// = See test.idl for an explanation of these methods.
CORBA::Long request (CORBA::Long id
TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
void start (const PeerSet& the_peers,
CORBA::Long iterations
TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
void shutdown (TAO_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
private:
Peer_Handler_i reply_handler_;
// The reply_handler
CORBA::ORB_var orb_;
// The orb
Progress_var progress_;
// The interface to report back progress.
ACE_Time_Value delay_;
// The delay on each request
CORBA::Long id_;
// The id assigned by the progress interface
};
class Peer_Task : public ACE_Task_Base
{
// = DESCRIPTION
// Run a "start" request on a separate thread.
public:
Peer_Task (const PeerSet& the_peers,
CORBA::Long iterations,
Progress_ptr progress,
AMI_PeerHandler_ptr handler,
CORBA::Long id);
virtual int svc (void);
// The thread entry point
private:
PeerSet the_peers_;
// The peers
CORBA::Long iterations_;
// The number of iterations
Progress_var progress_;
// To report progress
AMI_PeerHandler_var handler_;
// To issue async requests
CORBA::Long id_;
// Our id
};
#if defined(__ACE_INLINE__)
#include "Peer_i.i"
#endif /* __ACE_INLINE__ */
#endif /* PEER_I_H */
|