summaryrefslogtreecommitdiff
path: root/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.cpp
blob: c918a767b2c5a33a63ccb4d505524bf9dfcc3233 (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
// -*- C++ -*-

#include "Request_Interceptor.h"

ACE_RCSID (Request_Interceptor_Flow,
           Request_Interceptor,
           "$Id$")

Request_Interceptor::Request_Interceptor (const char *name)
  : name_ (name),
    starting_interception_point_count_ (0),
    ending_interception_point_count_ (0)
{
}

char *
Request_Interceptor::name (
    ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  return CORBA::string_dup (this->name_.in ());
}

void
Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{

  CORBA::ULong s_count =
    this->starting_interception_point_count_.value ();

  CORBA::ULong e_count =
    this->ending_interception_point_count_.value ();

  if (s_count == 0)
    {
      ACE_ERROR ((LM_ERROR,
                  "(%P) ERROR: Interceptor %d \"%s\"\n"
                  "(%P) The number of starting interception point calls "
                  "is zero\n", s_count,
                  this->name_.in ()));

      ACE_THROW (CORBA::INTERNAL ());
    }

  if (e_count == 0)
    {
      ACE_ERROR ((LM_ERROR,
                  "(%P) ERROR: Interceptor %d \"%s\"\n"
                  "(%P) The number of ending interception point calls"
                  "is zero\n",
                  e_count, this->name_.in ()));

      ACE_THROW (CORBA::INTERNAL ());
    }

  if (s_count != e_count)
    {
      ACE_ERROR ((LM_ERROR,
                  "(%P) ERROR: Interceptor \"%s\"\n"
                  "(%P) The number of starting interception point "
                  "calls (%u)\n"
                  "(%P) did not equal the number of ending "
                  "interception \n"
                  "(%P) point calls (%u).\n\n",
                  this->name_.in (),
                  s_count,
                  e_count));

      ACE_THROW (CORBA::INTERNAL ());
    }
}