Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / TAO / examples / Callback_Quoter / Consumer_Handler.h
blob71d4b4699794c5cbeaed09e5c1a1dd87504b1e37
1 //=============================================================================
2 /**
3 * @file Consumer_Handler.h
5 * Definition of the Callback_Qouter Consumer Client class, Consumer_Handler.
7 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
8 */
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)
20 # 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;
32 /**
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
43 public:
44 /// Constructor.
45 Consumer_Handler ();
47 /// Destructor.
48 ~Consumer_Handler ();
50 /// Initialize the client communication with the server.
51 int init (int argc, ACE_TCHAR *argv[]);
53 /// Start the ORB object.
54 int run ();
56 /// the name of the stock the consumer is interested in.
57 ACE_CString stock_name_;
59 /// the desired price of the stock.
60 int threshold_value_;
62 /// Server object ptr.
63 Notifier_var server_;
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
75 /// Notifier-server.
76 int registered_;
78 /// Flag which notes whether the consumer has got unregistered from
79 /// the Notifier-server.
80 int unregistered_;
82 private:
83 /// Our orb.
84 CORBA::ORB_var orb_;
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
90 /// error.
91 int parse_args ();
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.
98 int argc_;
100 /// arguments from command line.
101 ACE_TCHAR **argv_;
103 /// IOR of the obj ref of the server.
104 ACE_TCHAR *ior_;
106 /// Flag for server shutdown.
107 int shutdown_;
109 /// An instance of the name client used for resolving the factory
110 /// objects.
111 TAO_Naming_Client naming_services_client_;
113 /// This variable denotes whether the naming service
114 /// is used or not.
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?
124 int interactive_;
127 #endif /* CONSUMER_HANDLER_H */