summaryrefslogtreecommitdiff
path: root/TAO/tao_ace/IO_Event_Handler.h
blob: c165b6cb42b646498e93b721ffedd7a494a203ad (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
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    IO_Event_Handler.h
 *
 *  $Id$
 *
 *  @author Balachandran Natarajan <bala@cs.wustl.edu>
 */
//=============================================================================

#ifndef TAO_ACE_IO_EVENT_HANDLER_H
#define TAO_ACE_IO_EVENT_HANDLER_H
#include "ace/pre.h"
#include "IO_Event_Masks.h"



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

#include "Reactive_Handler.h"

/**
 * @class TAO_ACE_IO_Event_Handler
 *
 * @brief Provides an abstract interface for handling socket events.
 *
 * @@ todo<Bala>: Write comments
 */

class TAO_ACE_Export TAO_ACE_IO_Event_Handler: public TAO_ACE_Reactive_Handler
{
public:


  /* Callback function that invokes the right callback method based
   * on the type of mask that is passed via <t>. The mask should
   * indicate only one event. Sending a bitwise 'or' or 'and' of many
   * events will lead to none of the events being handled.
   */
  virtual int handle_event (TAO_ACE_IO_Event_Masks::Event_Masks t =
                            TAO_ACE_IO_Event_Masks::NULL_MASK);

  /// Get/Set the handle of the underlying socket
  virtual ACE_HANDLE get_handle (void) = 0;
  virtual void set_handle (ACE_HANDLE h) = 0;
protected:

  /// Called when input events occur (e.g., connection or data).
  virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE) = 0;

  /// Called when output events are possible (e.g., when flow control
  /// abates or non-blocking connection completes).
  virtual int handle_output (ACE_HANDLE fd = ACE_INVALID_HANDLE) = 0;

  /// Called when an exceptional events occur (e.g., SIGURG).
  virtual int handle_exception (ACE_HANDLE fd = ACE_INVALID_HANDLE) = 0;

private:

};


#include "ace/post.h"
#endif /*TAO_ACE_IO_EVENT_HANDLER_H*/