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

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

#ifndef TAO_ACE_IO_HANDLER_REPOSITORY_H
#define TAO_ACE_IO_HANDLER_REPOSITORY_H
#include "ace/pre.h"
#include "TAO_ACE_export.h"

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

#include "IO_Event_Masks.h"
#include "ace/Global_Macros.h"

class TAO_ACE_IO_Event_Handler;


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

class TAO_ACE_Export TAO_ACE_IO_Handler_Repository
{
public:

  virtual ~TAO_ACE_IO_Handler_Repository (void) = 0;

  class IO_Handler_State
  {
  public:

    /// Ctor
    IO_Handler_State (void);

    /// Number of threads actually dispatched to the socket handler
    long thread_count_;

    /// Has the handler been marked for deletion?
    int marked_for_deletion_;


    /// The IO event handler
    TAO_ACE_IO_Event_Handler *event_handler_;
  };


  /// Some common methods go here..

  virtual int bind (TAO_ACE_IO_Event_Handler *eh,
                    TAO_ACE_IO_Event_Masks::Event_Masks mask) = 0;


  virtual int unbind (TAO_ACE_IO_Event_Handler *eh,
                      TAO_ACE_IO_Event_Masks::Event_Masks mask) = 0;


  virtual int add_masks (ACE_HANDLE io,
                         TAO_ACE_IO_Event_Masks::Event_Masks mask) = 0;


  virtual int clr_masks (ACE_HANDLE io,
                         TAO_ACE_IO_Event_Masks::Event_Masks mask) = 0;

  virtual int find_state (ACE_HANDLE h,
                          TAO_ACE_IO_Handler_Repository::IO_Handler_State &st) = 0;

  virtual int rebind_state (
      TAO_ACE_IO_Handler_Repository::IO_Handler_State &st) = 0;

protected:

  /// @todo: Cant this be defined here?
  virtual int is_handle_valid (ACE_HANDLE handle) = 0;

private:

  ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_ACE_IO_Handler_Repository &));
};


#if defined (__ACE_INLINE__)
#include "IO_Handler_Repository.inl"
#endif /* __ACE_INLINE__ */


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