Merge pull request #2306 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / tests / Event / lib / Counting_Supplier.h
blob28c733a1173bd258069c81ac1d04c86a5e57cc13
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file Counting_Supplier.h
6 * @author Carlos O'Ryan (coryan@cs.wustl.edu)
7 */
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)
17 # pragma once
18 #endif /* ACE_LACKS_PRAGMA_ONCE */
20 #include "orbsvcs/Channel_Clients_T.h"
21 #include "orbsvcs/RtecEventChannelAdminC.h"
22 #include "ace/Task.h"
24 /**
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
33 public:
34 /// Constructor
35 EC_Counting_Supplier ();
37 // = The RtecEventComm::PushSupplier methods
39 /**
40 * Connect as a consumer to receive a TIMEOUT every <period>
41 * milliseconds.
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,
46 int period);
47 void deactivate ();
49 /// Simple connect/disconnect methods..
50 void connect (RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin,
51 int published_source,
52 int published_type,
53 int event_source,
54 int event_type);
55 void connect (RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin,
56 const RtecEventChannelAdmin::SupplierQOS &qos);
57 void disconnect ();
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;
72 private:
73 /// Adapter...
74 ACE_PushConsumer_Adapter<EC_Counting_Supplier> consumer_adapter_;
76 /// The adapter proxy...
77 RtecEventChannelAdmin::ProxyPushSupplier_var supplier_proxy_;
79 /// Our proxy
80 RtecEventChannelAdmin::ProxyPushConsumer_var consumer_proxy_;
82 /// The event source
83 int event_source_;
85 /// The event type
86 int event_type_;
89 class EC_Test_Export EC_Counting_Supplier_Task : public ACE_Task_Base
91 public:
92 /// Create the task...
93 EC_Counting_Supplier_Task (EC_Counting_Supplier *supplier);
95 // = Check the ACE_Task_Base documentation.
96 int svc ();
98 void stop ();
99 CORBA::ULong push_count ();
101 /// Run a single iteration of the test
102 void run ();
104 private:
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
112 int stop_flag_;
114 /// Count the number of push() calls
115 CORBA::ULong push_count_;
117 TAO_SYNCH_MUTEX lock_;
120 #endif /* ECT_SUPPLIER_H */