2 //=============================================================================
4 * @file Counting_Supplier.h
6 * @author Carlos O'Ryan (coryan@cs.wustl.edu)
8 //=============================================================================
11 #ifndef EC_COUNTING_SUPPLIER_H
12 #define EC_COUNTING_SUPPLIER_H
14 #include "ectest_export.h"
16 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 #endif /* ACE_LACKS_PRAGMA_ONCE */
20 #include "orbsvcs/Channel_Clients_T.h"
21 #include "orbsvcs/RtecEventChannelAdminC.h"
25 * @class EC_Counting_Supplier
27 * @brief Simple supplier object
29 * This class is a supplier of events.
31 class EC_Test_Export EC_Counting_Supplier
: public POA_RtecEventComm::PushSupplier
35 EC_Counting_Supplier ();
37 // = The RtecEventComm::PushSupplier methods
40 * Connect as a consumer to receive a TIMEOUT every <period>
42 * The class pushes an event (in its supplier role) every time it
43 * receives the timeout.
45 void activate (RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin
,
49 /// Simple connect/disconnect methods..
50 void connect (RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin
,
55 void connect (RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin
,
56 const RtecEventChannelAdmin::SupplierQOS
&qos
);
59 /// The Consumer side methods.
60 void push (const RtecEventComm::EventSet
& events
);
61 void disconnect_push_consumer ();
63 /// The skeleton methods.
64 virtual void disconnect_push_supplier ();
66 /// Count the number of events sent
67 CORBA::ULong event_count
;
69 /// Count the number of disconnect_push_supplier calls
70 CORBA::ULong disconnect_count
;
74 ACE_PushConsumer_Adapter
<EC_Counting_Supplier
> consumer_adapter_
;
76 /// The adapter proxy...
77 RtecEventChannelAdmin::ProxyPushSupplier_var supplier_proxy_
;
80 RtecEventChannelAdmin::ProxyPushConsumer_var consumer_proxy_
;
89 class EC_Test_Export EC_Counting_Supplier_Task
: public ACE_Task_Base
92 /// Create the task...
93 EC_Counting_Supplier_Task (EC_Counting_Supplier
*supplier
);
95 // = Check the ACE_Task_Base documentation.
99 CORBA::ULong
push_count ();
101 /// Run a single iteration of the test
105 /// The supplier we are turning into an active object
106 EC_Counting_Supplier
*supplier_
;
108 /// The event we push through the supplier
109 RtecEventComm::EventSet event_
;
111 /// Set to 1 when the test must stop
114 /// Count the number of push() calls
115 CORBA::ULong push_count_
;
117 TAO_SYNCH_MUTEX lock_
;
120 #endif /* ECT_SUPPLIER_H */