2 //=============================================================================
4 * @file Counting_Supplier.h
6 * @author Carlos O'Ryan (coryan@cs.wustl.edu)
8 //=============================================================================
11 #ifndef CEC_COUNTING_SUPPLIER_H
12 #define CEC_COUNTING_SUPPLIER_H
14 #include "cectest_export.h"
16 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 #endif /* ACE_LACKS_PRAGMA_ONCE */
20 #include "orbsvcs/CosEventCommS.h"
21 #include "orbsvcs/CosEventChannelAdminC.h"
25 * @class CEC_Counting_Supplier
27 * @brief Simple supplier object
29 * This class is a supplier of events.
31 class CEC_Test_Export CEC_Counting_Supplier
: public POA_CosEventComm::PushSupplier
35 CEC_Counting_Supplier ();
37 // = The CosEventComm::PushSupplier methods
39 /// Simple connect/disconnect methods..
40 void connect (CosEventChannelAdmin::SupplierAdmin_ptr supplier_admin
);
44 void push (const CORBA::Any
& events
);
46 /// The skeleton methods.
47 virtual void disconnect_push_supplier ();
49 /// Count the number of events sent
50 CORBA::ULong event_count
;
52 /// Count the number of disconnect_push_supplier calls
53 CORBA::ULong disconnect_count
;
57 CosEventChannelAdmin::ProxyPushConsumer_var consumer_proxy_
;
60 class CEC_Test_Export CEC_Counting_Supplier_Task
: public ACE_Task_Base
63 /// Create the task...
64 CEC_Counting_Supplier_Task (CEC_Counting_Supplier
*supplier
,
65 int milliseconds
= 0);
67 // = Check the ACE_Task_Base documentation.
71 CORBA::ULong
push_count ();
73 /// Run a single iteration of the test
77 /// The supplier we are turning into an active object
78 CEC_Counting_Supplier
*supplier_
;
80 /// Set to 1 when the test must stop
83 /// Count the number of push() calls
84 CORBA::ULong push_count_
;
86 /// If not zero then pause for <milliseconds> before sending each
90 TAO_SYNCH_MUTEX lock_
;
93 // ****************************************************************
96 * @class CEC_Pull_Counting_Supplier
98 * @brief Simple supplier object
100 * This class is a supplier of events.
102 class CEC_Test_Export CEC_Pull_Counting_Supplier
: public POA_CosEventComm::PullSupplier
106 CEC_Pull_Counting_Supplier ();
108 // = The CosEventComm::PullSupplier methods
110 /// Simple connect/disconnect methods..
111 void connect (CosEventChannelAdmin::SupplierAdmin_ptr supplier_admin
);
114 // The PullSupplier methods.
116 CORBA::Any
* try_pull (CORBA::Boolean_out has_event
);
117 virtual void disconnect_pull_supplier ();
119 /// Count the number of events sent
120 CORBA::ULong event_count
;
122 /// Count the number of disconnect_pull_supplier calls
123 CORBA::ULong disconnect_count
;
127 CosEventChannelAdmin::ProxyPullConsumer_var consumer_proxy_
;
130 #endif /* ECT_SUPPLIER_H */