Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Event / lib / Counting_Consumer.h
blob91cbe46044584e2777befa5a41e4ca7de8bcf490
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file Counting_Consumer.h
6 * @author Carlos O'Ryan (coryan@cs.wustl.edu)
7 */
8 //=============================================================================
11 #ifndef EC_COUNTING_CONSUMER_H
12 #define EC_COUNTING_CONSUMER_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/RtecEventCommS.h"
21 #include "orbsvcs/RtecEventChannelAdminC.h"
23 /**
24 * @class EC_Counting_Consumer
26 * @brief Simple consumer object to implement EC tests.
28 * This is a simple consumer that counts the events it receives.
30 class EC_Test_Export EC_Counting_Consumer : public POA_RtecEventComm::PushConsumer
32 public:
33 /// Constructor
34 EC_Counting_Consumer (const char* name);
36 /// Simple connect/disconnect methods..
37 void connect (RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin,
38 const RtecEventChannelAdmin::ConsumerQOS &qos);
39 void disconnect (void);
40 void deactivate (void);
42 /// Print out an error message if the event count is too far from the
43 /// expected count.
44 void dump_results (int expected_count, int tolerance);
46 // = The RtecEventComm::PushConsumer methods
48 /// The skeleton methods.
49 virtual void push (const RtecEventComm::EventSet& events);
50 virtual void disconnect_push_consumer (void);
52 /// Keep track of the number of events received.
53 CORBA::ULong event_count;
55 /// Keep track of the number of disconnect calls received.
56 CORBA::ULong disconnect_count;
58 protected:
59 /// The proxy
60 RtecEventChannelAdmin::ProxyPushSupplier_var supplier_proxy_;
62 /// The name
63 const char* name_;
66 #endif /* ECT_CONSUMER_H */