blob: d40b29ab84a57f7f6bb3ba22045d13d0b04efda3 (
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
/* -*- C++ -*- */
// $Id$
//
// ============================================================================
//
// = LIBRARY
// ORBSVCS COS Event Channel tests
//
// = FILENAME
// Random.h
//
// = AUTHOR
// Carlos O'Ryan (coryan@cs.wustl.edu)
//
// ============================================================================
#ifndef EC_RANDOM_H
#define EC_RANDOM_H
#include "orbsvcs/orbsvcs/CosEventCommS.h"
#include "orbsvcs/orbsvcs/CosEventChannelAdminS.h"
#include "ace/Task.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined(_MSC_VER)
#if (_MSC_VER >= 1200)
#pragma warning(push)
#endif /* _MSC_VER >= 1200 */
#pragma warning(disable:4250)
#endif /* _MSC_VER */
class RND_Driver;
class RND_Consumer
: public POA_CosEventComm::PushConsumer
, public PortableServer::RefCountServantBase
{
// = TITLE
// Simple consumer object
//
// = DESCRIPTION
//
public:
RND_Consumer (RND_Driver *driver);
// Constructor
void push (const CORBA::Any &event
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
void connect (CosEventChannelAdmin::ConsumerAdmin_ptr admin
ACE_ENV_ARG_DECL);
void disconnect (ACE_ENV_SINGLE_ARG_DECL);
protected:
RND_Driver *driver_;
// The driver
CosEventChannelAdmin::ProxyPushSupplier_var proxy_;
// The supplier.
TAO_SYNCH_MUTEX lock_;
// Synch
};
inline
RND_Consumer::RND_Consumer (RND_Driver *driver)
: driver_ (driver)
{
}
// ****************************************************************
class RND_Timer : public RND_Consumer
{
public:
RND_Timer (RND_Driver *driver);
void push (const CORBA::Any &event
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
};
inline
RND_Timer::RND_Timer (RND_Driver *driver)
: RND_Consumer (driver)
{
}
// ****************************************************************
class RND_Supplier
: public POA_CosEventComm::PushSupplier
, public PortableServer::RefCountServantBase
, public ACE_Task_Base
{
// = TITLE
// Simple supplier object
//
// = DESCRIPTION
//
public:
RND_Supplier (void);
// Constructor
void connect (CosEventChannelAdmin::SupplierAdmin_ptr admin
ACE_ENV_ARG_DECL);
void disconnect (ACE_ENV_SINGLE_ARG_DECL);
void push_new_event (ACE_ENV_SINGLE_ARG_DECL);
void push (CORBA::Any &event
ACE_ENV_ARG_DECL);
// Push a single event...
virtual void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
virtual int svc (void);
// Active method
private:
CosEventChannelAdmin::ProxyPushConsumer_var proxy_;
// The supplier.
TAO_SYNCH_MUTEX lock_;
// Synch
};
inline
RND_Supplier::RND_Supplier (void)
{
}
// ****************************************************************
class RND_Driver
{
public:
RND_Driver (void);
int run (int argc, char *argv[]);
// Run the test
void timer (const CORBA::Any &e
ACE_ENV_ARG_DECL);
// The main timer has expired
void event (const CORBA::Any &e
ACE_ENV_ARG_DECL);
// One of the consumers has received an event
private:
RND_Driver (const RND_Driver &);
RND_Driver& operator= (const RND_Driver &);
private:
RND_Supplier supplier_;
// The supplier
int nsuppliers_;
// Number of suppliers
RND_Supplier **suppliers_;
// The suppliers
int nconsumers_;
// Number of consumers
RND_Consumer **consumers_;
// The consumers
int max_recursion_;
// Maximum recursion
CosEventChannelAdmin::ConsumerAdmin_var consumer_admin_;
CosEventChannelAdmin::SupplierAdmin_var supplier_admin_;
};
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning(pop)
#endif /* _MSC_VER */
#endif /* EC_RANDOM_H */
|