summaryrefslogtreecommitdiff
path: root/apps/Orbix-Examples/Event_Comm/Consumer/Input_Handler.h
blob: e8a193e83859cc1777b77bdcbdf3035cc1a4cc85 (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
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    EventComm
//
// = FILENAME
//    Input_Handler.h
//
// = AUTHOR
//    Douglas C. Schmidt (schmidt@cs.wustl.edu)
//
// ============================================================================

#ifndef _INPUT_HANDLER_H
#define _INPUT_HANDLER_

#include "ace/Service_Config.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#if defined (ACE_HAS_ORBIX) && (ACE_HAS_ORBIX != 0)
// Forward declaration.
class Notification_Receiver_Handler;

class Input_Handler : public ACE_Service_Object
{
  // = TITLE
  //   Handles input events generated from a keyboard.
  //
  // = DESCRIPTION
  //    This subclass <ACE_Service_Object> receives "unsubscribes"
  //    from the <Notifier> when input is received from the keyboard.
public:
  Input_Handler (Notification_Receiver_Handler *,
                 ACE_HANDLE h = 0);

  virtual int handle_input (ACE_HANDLE);
  // Dispatch the callback when events occur.

  virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE,
                            ACE_Reactor_Mask = ACE_Event_Handler::NULL_MASK);
  // Close down the handler.

  int consumer_initiated_shutdown (void);
  // Report whether the Consumer initiated the shutdown.

  void consumer_initiated_shutdown (int);
  // Indicate that the Consumer initiated the shutdown.

private:
  ~Input_Handler (void);
  // Ensure dynamic allocation.

  virtual ACE_HANDLE get_handle (void) const;

  ACE_HANDLE handle_;
  // ACE_HANDLE where the input comes from.

  Notification_Receiver_Handler *receiver_handler_;
  // Pointer to the <Notification_Receiver_Handler> that receives
  // notifications from the <Event_Comm::Notifier>.

  int consumer_initiated_shutdown_;
  // Keep track of whether the Consumer initiated the shutdown.
};

#endif /* ACE_HAS_ORBIX */
#endif /* _INPUT_HANDLER_H */