Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / CosEvent / lib / Counting_Supplier.h
blob73ee061f1c3f6f6140a7e2ac552126779d9579bd
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file Counting_Supplier.h
6 * @author Carlos O'Ryan (coryan@cs.wustl.edu)
7 */
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)
17 # pragma once
18 #endif /* ACE_LACKS_PRAGMA_ONCE */
20 #include "orbsvcs/CosEventCommS.h"
21 #include "orbsvcs/CosEventChannelAdminC.h"
22 #include "ace/Task.h"
24 /**
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
33 public:
34 /// Constructor
35 CEC_Counting_Supplier ();
37 // = The CosEventComm::PushSupplier methods
39 /// Simple connect/disconnect methods..
40 void connect (CosEventChannelAdmin::SupplierAdmin_ptr supplier_admin);
41 void disconnect ();
43 /// Push an event.
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;
55 private:
56 /// Our proxy
57 CosEventChannelAdmin::ProxyPushConsumer_var consumer_proxy_;
60 class CEC_Test_Export CEC_Counting_Supplier_Task : public ACE_Task_Base
62 public:
63 /// Create the task...
64 CEC_Counting_Supplier_Task (CEC_Counting_Supplier *supplier,
65 int milliseconds = 0);
67 // = Check the ACE_Task_Base documentation.
68 int svc ();
70 void stop ();
71 CORBA::ULong push_count ();
73 /// Run a single iteration of the test
74 void run ();
76 private:
77 /// The supplier we are turning into an active object
78 CEC_Counting_Supplier *supplier_;
80 /// Set to 1 when the test must stop
81 int stop_flag_;
83 /// Count the number of push() calls
84 CORBA::ULong push_count_;
86 /// If not zero then pause for <milliseconds> before sending each
87 /// event.
88 int milliseconds_;
90 TAO_SYNCH_MUTEX lock_;
93 // ****************************************************************
95 /**
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
104 public:
105 /// Constructor
106 CEC_Pull_Counting_Supplier ();
108 // = The CosEventComm::PullSupplier methods
110 /// Simple connect/disconnect methods..
111 void connect (CosEventChannelAdmin::SupplierAdmin_ptr supplier_admin);
112 void disconnect ();
114 // The PullSupplier methods.
115 CORBA::Any* pull ();
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;
125 private:
126 /// Our proxy
127 CosEventChannelAdmin::ProxyPullConsumer_var consumer_proxy_;
130 #endif /* ECT_SUPPLIER_H */