blob: d64a6bcb66dd67eca7cb04ebd06165056bd66ff2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/* -*- C++ -*- */
// $Id$
// ===========================================================
//
//
// = LIBRARY
// TAO/examples/Callback_Quoter
//
// = FILENAME
// Consumer_Input_Handler.h
//
// = DESCRIPTION
// Definition of the Callback_Qouter Consumer Client class, Consumer_Input_Handler.
//
// = AUTHOR
// Kirthika Parameswaran <kirthika@cs.wustl.edu>
//
// ===========================================================
#ifndef CONSUMER_INPUT_HANDLER_H
#define CONSUMER_INPUT_HANDLER_H
#include "ace/Reactor.h"
#include "ace/Event_Handler.h"
#include "Consumer_Handler.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
// Creating a class to handle input events.
// Since only inputs need to be handled, only the handle_input
// method is overlaoded.
class Consumer_Handler;
class Consumer_Input_Handler : public ACE_Event_Handler
{
// = TITLE
// Callback Quoter Consumer Client class.
//
// = DESCRIPTION
// Connects to the Callback Quoter server and
// registers the Consumer object with the it
// and receives the stock status from the Notifier.
public:
Consumer_Input_Handler (Consumer_Handler *consumer_handler);
// Constructor.
int handle_input (ACE_HANDLE);
// Handle the user input.
int register_consumer (void);
// Registration with the notifier.
int unregister_consumer (void);
// Cancelling the registration with the notifier.
int quit_consumer_process (void);
// Ends the consumer process.
friend class ACE_Shutup_GPlusPlus;
// Turn off g++ warning
enum
{
// = TITLE
// A set of values for the execution of the consumer.
//
// = DESCRIPTION
// Used so that the process of registering, unregistering
// and exitting neednt be dependent on 'r' 'u' and 'q'.
// Also, #define clutters up the global namespace.
REGISTER = 'r',
// The character that the user must type to register the consumer with
// the Notifier_server.
UNREGISTER = 'u',
// The character that the user must type to unregister the consumer with
// the Notifier_server.
EXIT = 'q'
// The character the user must type to quit the consumer client
// application.
};
private:
~Consumer_Input_Handler (void);
// the destructor.
Consumer_Handler *consumer_handler_;
// The Consumer_Handler object.
};
#endif /* CONSUMER_INPUT_HANDLER_H */
|