3 // ============================================================================
6 // This test to measure how many events per minute can the EC
7 // process, it also serves as an example how how to encode complex
8 // data types in a octet sequence.
10 // ============================================================================
12 #ifndef ECT_CONSUMER_DRIVER_H
13 #define ECT_CONSUMER_DRIVER_H
15 #include "ECT_Driver.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ECT_Consumer.h"
22 #include "orbsvcs/Channel_Clients_T.h"
23 #include "orbsvcs/RtecEventChannelAdminC.h"
25 #include "ace/High_Res_Timer.h"
27 class ECT_Consumer_Driver
: public ECT_Driver
35 ECT_Consumer_Driver ();
36 virtual ~ECT_Consumer_Driver ();
40 // Maximum number of consumers.
43 int run (int argc
, ACE_TCHAR
* argv
[]);
46 virtual void shutdown_consumer (void* consumer_cookie
);
47 // Callback method for consumers, each consumer will call this
48 // method once it receives all the shutdown events from the
52 int parse_args (int argc
, ACE_TCHAR
* argv
[]);
53 // parse the command line args
55 void connect_consumers (RtecScheduler::Scheduler_ptr scheduler
,
56 RtecEventChannelAdmin::EventChannel_ptr local_ec
);
57 void disconnect_consumers ();
58 // Connect and disconnect the consumers.
61 // Print out the results
64 Test_Consumer
* consumers_
[ECT_Consumer_Driver::MAX_CONSUMERS
];
65 // The consumer array.
68 // The number of consumers.
71 // How many suppliers are sending events, used for shutdown, each
72 // supplier sends a shutdown message after it finishes, the consumer
73 // finishes when all the suppliers do.
77 // We receive the events whose type is in the range
78 // [type_start,type_start+type_count)
81 // How long (in seconds) the consumer will wait after receiving the first event.
83 int shutdown_event_channel_
;
84 // If not zero it will shutdown the event channel upon exit.
86 const ACE_TCHAR
* pid_file_name_
;
87 // The name of a file where the process stores its pid
90 // A reference to the ORB, to shut it down properly.
92 TAO_SYNCH_MUTEX lock_
;
94 // How many consumers are still receiving events.
97 #endif /* ECT_CONSUMER_DRIVER_H */