Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / examples / Event_Comm / Consumer_Handler.h
blobeaed47f1ffc549773ac3f876711cd9674c85eefc
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Consumer_Handler.h
7 * Subclass of Corba_Handler that sets up the Consumer handler
8 * for use with the ACE ACE_Reactor.
10 * @author Douglas C. Schmidt (d.schmidt@vanderbilt.edu) and Pradeep Gore (pradeep@cs.wustl.edu)
12 //=============================================================================
15 #ifndef _CONSUMER_HANDLER_H
16 #define _CONSUMER_HANDLER_H
18 #include "Event_Comm_i.h"
19 #include "orbsvcs/Naming/Naming_Client.h"
20 #include "orbsvcs/CosNamingC.h"
22 /**
23 * @class Consumer_Handler
25 * @brief The Consumer_Handler class.
27 * Starts up the ORB, registers the <Event_Comm::Consumer>
28 * servant with the orb and gets a reference to a <Notifier>
29 * from the Naming Service.
31 class Consumer_Handler
33 public:
34 /// Constructor.
35 Consumer_Handler (void);
37 /// Destructor.
38 virtual ~Consumer_Handler (void);
40 /// Initializes the ORB, gets the Notifier reference from the Naming
41 /// Service, and starts the servant for the Consumer object.
42 int init (int argc, ACE_TCHAR *argv[], ShutdownCallback *_shutdowncallback);
44 /// runs the ORB.
45 int run (void);
47 /// shutdown the orb.
48 void close (void);
50 /// called to shutdown the consumer application.
51 void shutdown (void);
53 // = Accessors
54 Event_Comm::Consumer *receiver (void);
55 Event_Comm::Notifier *notifier (void);
57 /// returns the ORB's reactor.
58 ACE_Reactor *reactor (void);
60 private:
61 /// gets the notifier reference from the naming service.
62 /// returns 0 on success, -1 on error.
63 int get_notifier (void);
65 /// Remember our orb.
66 CORBA::ORB_var orb_;
68 /// The <Consumer> implementation.
69 Consumer_i receiver_i_;
71 /// Pointer to an IDL <Consumer> proxy object.
72 Event_Comm::Consumer_var receiver_;
74 /// Pointer to an IDL <Notifier> proxy object.
75 Event_Comm::Notifier_var notifier_;
77 /// An instance of the name client used for resolving the factory
78 /// objects.
79 TAO_Naming_Client naming_services_client_;
81 /// The Shutdown callback used to shutdown the consumer application.
82 ShutdownCallback* shutdowncallback;
85 #define NOTIFIER_BIND_NAME "Notifier"
87 #endif /* _CONSUMER_HANDLER_H */