3 //=============================================================================
5 * @file Consumer_Handler.h
7 * Definition of the Callback_Qouter Consumer Client class, Consumer_Handler.
9 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
11 //=============================================================================
14 #ifndef CONSUMER_HANDLER_H
15 #define CONSUMER_HANDLER_H
17 #include "ConsumerC.h"
18 #include "NotifierC.h"
19 #include "Consumer_i.h"
20 #include "ace/Read_Buffer.h"
22 #if !defined (ACE_LACKS_PRAGMA_ONCE)
24 #endif /* ACE_LACKS_PRAGMA_ONCE */
26 #include "orbsvcs/Naming/Naming_Client.h"
27 #include "orbsvcs/CosNamingC.h"
29 #include "Consumer_Input_Handler.h"
30 #include "Consumer_Signal_Handler.h"
32 class Consumer_Input_Handler
;
33 class Consumer_Signal_Handler
;
36 * @class Consumer_Handler
38 * @brief Callback Quoter Consumer Client class.
40 * Connects to the Callback Quoter server and
41 * registers the Consumer object with the it
42 * and receives the stock status from the Notifier.
44 class Consumer_Handler
48 Consumer_Handler (void);
51 ~Consumer_Handler (void);
53 /// Initialize the client communication with the server.
54 int init (int argc
, ACE_TCHAR
*argv
[]);
56 /// Start the ORB object.
59 /// the name of the stock the consumer is interested in.
60 ACE_CString stock_name_
;
62 /// the desired price of the stock.
65 /// Server object ptr.
68 /// The consumer object.
69 Consumer_i
*consumer_servant_
;
71 /// Pointer to the consumer object registered with the ORB.
72 Callback_Quoter::Consumer_var consumer_var_
;
74 /// This method gives the reactor pointer.
75 ACE_Reactor
* reactor_used (void) const;
77 /// Flag which notes whether the consumer has got registered with the
81 /// Flag which notes whether the consumer has got unregistered from
82 /// the Notifier-server.
90 /// Function to read the server IOR from a file.
91 int read_ior (ACE_TCHAR
*filename
);
93 /// Parse the command line arguments. Returns 0 on success, -1 on
95 int parse_args (void);
97 /// This method initialises the naming service and registers the
98 /// object with the POA.
99 int via_naming_service (void);
101 /// # of arguments on the command line.
104 /// arguments from command line.
107 /// IOR of the obj ref of the server.
110 /// Flag for server shutdown.
113 /// An instance of the name client used for resolving the factory
115 TAO_Naming_Client naming_services_client_
;
117 /// This variable denotes whether the naming service
119 int use_naming_service_
;
121 /// Reference to the input_event_handler.
122 Consumer_Input_Handler
*consumer_input_handler_
;
124 /// Reference to the signal_event_handler.
125 Consumer_Signal_Handler
*consumer_signal_handler_
;
127 /// Is the example interactive?
131 #endif /* CONSUMER_HANDLER_H */