3 //=============================================================================
5 * @file Consumer_Input_Handler.h
7 * @author Douglas C. Schmidt (d.schmidt@vanderbilt.edu)
9 //=============================================================================
12 #ifndef CONSUMER_INPUT_HANDLER_H
13 #define CONSUMER_INPUT_HANDLER_H
15 #include "ace/Service_Config.h"
16 #include "ace/Event_Handler.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 // Forward declaration.
24 class Consumer_Handler
;
27 * @class Consumer_Input_Handler
29 * @brief Handles input events generated from a keyboard.
31 * This class holds a <Consumer_Handler> object. It accepts input
32 * from the user and passes events to the <Notifier>. It also
35 class Consumer_Input_Handler
: public ACE_Event_Handler
38 // Initialization and termination methods.
40 Consumer_Input_Handler();
43 ~Consumer_Input_Handler () = default;
45 /// registers the input event handler.
46 /// returns 0 on success, -1 on error.
47 int initialize (Consumer_Handler
*);
49 /// Dispatch the callback when events occur.
50 virtual int handle_input (ACE_HANDLE
);
52 /// Close down the handler.
55 /// Report whether the Consumer initiated the shutdown.
56 int consumer_initiated_shutdown ();
58 /// Indicate that the Consumer initiated the shutdown.
59 void consumer_initiated_shutdown (int);
62 /// Pointer to the <Consumer_Handler> that receives notifications
63 /// from the <Event_Comm::Notifier>.
64 Consumer_Handler
*receiver_handler_
;
66 /// Keep track of whether the Consumer initiated the shutdown.
67 int consumer_initiated_shutdown_
;
70 #endif /* CONSUMER_INPUT_HANDLER_H */