Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / examples / Callback_Quoter / Consumer_Input_Handler.h
blob89f857d14c36ffa3377615e2c2a4a20b03b2fcac
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Consumer_Input_Handler.h
7 * Definition of the Callback_Qouter Consumer Client class, Consumer_Input_Handler.
9 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
11 //=============================================================================
14 #ifndef CONSUMER_INPUT_HANDLER_H
15 #define CONSUMER_INPUT_HANDLER_H
17 #include "ace/Reactor.h"
18 #include "ace/Event_Handler.h"
19 #include "Consumer_Handler.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 // Creating a class to handle input events.
26 // Since only inputs need to be handled, only the handle_input
27 // method is overlaoded.
28 class Consumer_Handler;
30 /**
31 * @class Consumer_Input_Handler
33 * @brief Callback Quoter Consumer Client class.
35 * Connects to the Callback Quoter server and
36 * registers the Consumer object with the it
37 * and receives the stock status from the Notifier.
39 class Consumer_Input_Handler : public ACE_Event_Handler
41 public:
42 /// Constructor.
43 Consumer_Input_Handler (Consumer_Handler *consumer_handler);
45 /// Handle the user input.
46 int handle_input (ACE_HANDLE) override;
48 /// Registration with the notifier.
49 int register_consumer ();
51 /// Cancelling the registration with the notifier.
52 int unregister_consumer ();
54 /// Ends the consumer process.
55 int quit_consumer_process ();
57 /// A set of values for the execution of the consumer.
58 ///
59 /// Used so that the process of registering, unregistering
60 /// and exiting neednt be dependent on 'r' 'u' and 'q'.
61 /// Also, #define clutters up the global namespace.
62 enum
64 /// The character that the user must type to register the consumer with
65 /// the Notifier_server.
66 REGISTER = 'r',
68 /// The character that the user must type to unregister the consumer with
69 /// the Notifier_server.
70 UNREGISTER = 'u',
72 /// The character the user must type to quit the consumer client
73 /// application.
74 EXIT = 'q'
77 protected:
78 /// Destructor.
79 ~Consumer_Input_Handler () = default;
81 private:
82 /// The Consumer_Handler object.
83 Consumer_Handler *consumer_handler_;
86 #endif /* CONSUMER_INPUT_HANDLER_H */