// ============================================================================
// = FILENAME
//    inputhandler.h
//    Modified version of supplier_input_handler.h from TAO library
//
// = DESCRIPTION
//    Handle input from the keyboard.
//
// = AUTHOR
//    Douglas C. Schmidt (schmidt@cs.wustl.edu) and
//    Pradeep Gore (pradeep@cs.wustl.edu)

//
// ============================================================================

#ifndef INPUT_HANDLER_H
#define INPUT_HANDLER_H

#include "ace/Service_Config.h"
#undef _WINDOWS_
#include "eventobject.h"

// Forward declaration.
class Supplier;

class InputHandler : public ACE_Event_Handler
{
  // = 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.
  InputHandler (void);
  // Constructor.

  ~InputHandler (void);
  // Destructor.

  int initialize (Supplier *);
  // Initialization.

  virtual int handle_input (ACE_HANDLE);
  // Frame input events and notify <Consumers>.

  int close (void);
  // Close down the handler.

  EventObject shutdown_;
  // Event object used to shutdown system

private:
    Supplier *supplier_;
  // Pointer to a <supplier> that's used to inform Consumers
  // that events of interest have occurred.

	void sendShutdown();
	// Sets event object semaphore
};

#endif /* SUPPLIER_INPUT_HANDLER_H */
