1 //=============================================================================
3 * @file Consumer_Handler.h
5 * Definition of the Callback_Qouter Consumer Client class, Consumer_Handler.
7 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
9 //=============================================================================
11 #ifndef CONSUMER_HANDLER_H
12 #define CONSUMER_HANDLER_H
14 #include "ConsumerC.h"
15 #include "NotifierC.h"
16 #include "Consumer_i.h"
17 #include "ace/Read_Buffer.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "orbsvcs/Naming/Naming_Client.h"
24 #include "orbsvcs/CosNamingC.h"
26 #include "Consumer_Input_Handler.h"
27 #include "Consumer_Signal_Handler.h"
29 class Consumer_Input_Handler
;
30 class Consumer_Signal_Handler
;
33 * @class Consumer_Handler
35 * @brief Callback Quoter Consumer Client class.
37 * Connects to the Callback Quoter server and
38 * registers the Consumer object with the it
39 * and receives the stock status from the Notifier.
41 class Consumer_Handler
50 /// Initialize the client communication with the server.
51 int init (int argc
, ACE_TCHAR
*argv
[]);
53 /// Start the ORB object.
56 /// the name of the stock the consumer is interested in.
57 ACE_CString stock_name_
;
59 /// the desired price of the stock.
62 /// Server object ptr.
65 /// The consumer object.
66 Consumer_i
*consumer_servant_
{};
68 /// Pointer to the consumer object registered with the ORB.
69 Callback_Quoter::Consumer_var consumer_var_
;
71 /// This method gives the reactor pointer.
72 ACE_Reactor
* reactor_used () const;
74 /// Flag which notes whether the consumer has got registered with the
78 /// Flag which notes whether the consumer has got unregistered from
79 /// the Notifier-server.
86 /// Function to read the server IOR from a file.
87 int read_ior (ACE_TCHAR
*filename
);
89 /// Parse the command line arguments. Returns 0 on success, -1 on
93 /// This method initializes the naming service and registers the
94 /// object with the POA.
95 int via_naming_service ();
97 /// # of arguments on the command line.
100 /// arguments from command line.
103 /// IOR of the obj ref of the server.
106 /// Flag for server shutdown.
109 /// An instance of the name client used for resolving the factory
111 TAO_Naming_Client naming_services_client_
;
113 /// This variable denotes whether the naming service
115 int use_naming_service_
;
117 /// Reference to the input_event_handler.
118 Consumer_Input_Handler
*consumer_input_handler_
;
120 /// Reference to the signal_event_handler.
121 Consumer_Signal_Handler
*consumer_signal_handler_
;
123 /// Is the example interactive?
127 #endif /* CONSUMER_HANDLER_H */