summaryrefslogtreecommitdiff
path: root/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp
blob: 727319bb0e71c999fff62039fc7c11b72a170d93 (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
// $Id$

#include "IORInterceptor_Adapter_Impl.h"
#include "tao/debug.h"

ACE_RCSID (IORInterceptor,
           IORInterceptor_Adapter_Impl,
           "$Id$")


TAO_IORInterceptor_Adapter_Impl::~TAO_IORInterceptor_Adapter_Impl (void)
{
}

void
TAO_IORInterceptor_Adapter_Impl::add_interceptor (
    PortableInterceptor::IORInterceptor_ptr i
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  this->ior_interceptor_list_.add_interceptor (i
                                               ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;
}

void
TAO_IORInterceptor_Adapter_Impl::destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL)
  ACE_THROW_SPEC (())
{
  TAO_IORInterceptor_List::TYPE & i =
    this->ior_interceptor_list_.interceptors ();

  const size_t len = i.size ();
  size_t ilen = len;

  ACE_TRY
    {
      for (size_t k = 0; k < len; ++k)
        {
          // Destroy the interceptors in reverse order in case the
          // array list is only partially destroyed and another
          // invocation occurs afterwards.
          --ilen;

          i[k]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
          ACE_TRY_CHECK;

          // Since Interceptor::destroy() can throw an exception,
          // decrease the size of the interceptor array incrementally
          // since some interceptors may not have been destroyed yet.
          // Note that this size reduction is fast since no memory is
          // actually deallocated.
          i.size (ilen);
        }
    }
  ACE_CATCHALL
    {
      // Exceptions should not be propagated beyond this call.
      if (TAO_debug_level > 3)
        {
          ACE_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("TAO (%P|%t) - Exception in ")
                      ACE_TEXT ("IORInterceptor_Adapter_Impl")
                      ACE_TEXT ("::destroy_interceptors () \n")));
        }
    }
  ACE_ENDTRY;
  ACE_CHECK;

  delete this;
}

TAO_IORInterceptor_List *
TAO_IORInterceptor_Adapter_Impl::interceptor_list (void)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  return &this->ior_interceptor_list_;
}