summaryrefslogtreecommitdiff
path: root/TAO/examples/Event_Comm/Supplier_Input_Handler.h
blob: cd52731b7778be73b2239803491bb50a46953177 (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
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    EventComm
//
// = FILENAME
//    Supplier_Input_Handler.h
//
// = DESCRIPTION
//    Handle input from the keyboard.
//
// = AUTHOR
//    Douglas C. Schmidt (schmidt@cs.wustl.edu) and Pradeep Gore (pradeep@cs.wistl.edu)
//
// ============================================================================

#ifndef SUPPLIER_INPUT_HANDLER_H
#define SUPPLIER_INPUT_HANDLER_H

#include "ace/Service_Config.h"

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

// Forward declaration.
class Notifier_Handler;

class Supplier_Input_Handler : public ACE_Service_Object
{
  // = TITLE
  //   Handles input events generated from a keyboard.
  //
  // = DESCRIPTION
  //   The events are currently framed and forwarded to all Consumers.
  //   In the future, we will need to be more selective and only send
  //   to those Consumers whose filtering criteria matches!
public:
  // = Initialization and termination methods.
  Supplier_Input_Handler (void);
  // Constructor.

  ~Supplier_Input_Handler (void);
  // Destructor.

  int initialize (Notifier_Handler *, ACE_HANDLE = ACE_STDIN);
  // Initialization, uses stdin by default.

  virtual int handle_input (ACE_HANDLE);
  // Frame input events and notify <Consumers>.

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

protected:
  virtual ACE_HANDLE get_handle (void) const;
  // Return the input handle.

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

  Notifier_Handler *notifier_;
  // Pointer to a <Notifier_Handler> that's used to inform Consumers
  // that events of interest have occurred.

  FILE *fp_;
  // Pointer to an input FILE.
};

#endif /* SUPPLIER_INPUT_HANDLER_H */