summaryrefslogtreecommitdiff
path: root/TAO/tao/PI/Interceptor_List_T.h
blob: 049027473eca5572f73ea1720d50d05681276d23 (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
// -*- C++ -*-

// ===================================================================
/**
 *  @file   Interceptor_List_T.h
 *
 *  @author Ossama Othman <ossama@uci.edu>
 *  @author Johnny Willemsen  <jwillemsen@remedy.nl>
 */
// ===================================================================

#ifndef TAO_INTERCEPTOR_LIST_H
#define TAO_INTERCEPTOR_LIST_H

#include /**/ "ace/pre.h"

#include "ace/Array_Base.h"

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

#include "tao/orbconf.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace PortableInterceptor
{
  class Interceptor;
  typedef Interceptor *Interceptor_ptr;
}

namespace CORBA
{
  class PolicyList;
}

namespace TAO
{
  /**
   * @class Interceptor_List
   *
   * @brief Template for portable interceptor lists.
   *
   * Template for the various portable interceptor lists used
   * internally by TAO.
   */
  template <typename InterceptorType, typename DetailsType>
  class Interceptor_List
  {
  public:
    /// Define the traits for the underlying portable interceptor array.
    typedef typename InterceptorType::_var_type InterceptorType_var_type;
    typedef typename InterceptorType::_ptr_type InterceptorType_ptr_type;

    struct RegisteredInterceptor
    {
      InterceptorType_var_type interceptor_;
      DetailsType              details_;
    };

    /// Constructor.
    Interceptor_List ();

    void add_interceptor (InterceptorType_ptr_type i);

    /// Register an interceptor with policies.
    void add_interceptor (InterceptorType_ptr_type i,
                          const CORBA::PolicyList& policies);

    void destroy_interceptors ();

    /// Return the registered interceptor in sequence element @a index.
    RegisteredInterceptor& registered_interceptor (size_t index);

    /// Return the interceptor in sequence element @a index.
    InterceptorType_ptr_type interceptor (size_t index);

    size_t size () const;

  private:
    typedef ACE_Array_Base<RegisteredInterceptor > RegisteredArray;

    /// Dynamic array of registered interceptors.
    RegisteredArray interceptors_;
  };
}

TAO_END_VERSIONED_NAMESPACE_DECL

#include "tao/PI/Interceptor_List_T.cpp"

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

#endif /* TAO_INTERCEPTOR_LIST_H */