summaryrefslogtreecommitdiff
path: root/TAO/tests/NestedUpcall/Reactor/eh_i.cpp
blob: 0ca6c479613e7d3036f080b8d60eed16de8b7957 (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
// $Id$

#include "tao/corba.h"
#include "eh_i.h"

ACE_RCSID(Reactor, eh_i, "$Id$")

// CTOR
EventHandler_i::EventHandler_i (int q)
  :  quiet_ (q)
{
}

// DTOR
EventHandler_i::~EventHandler_i (void)
{
}

// Return a long
CORBA::Long
EventHandler_i::peer (CORBA::Environment &)
    ACE_THROW_SPEC ((CORBA::SystemException))
{
  // Doesn't matter what value we return!
  CORBA::Long val = 6;

  if (!this->quiet_)
    ACE_DEBUG ((LM_DEBUG,
                "EventHandler_i::peer() returning %d\n",
                val));

  return val;
}

CORBA::UShort
EventHandler_i::decrement (Reactor_ptr eh,
                           CORBA::UShort num,
                           CORBA::Environment &env)
    ACE_THROW_SPEC ((CORBA::SystemException))
{
  if (this->quiet_ == 0)
    {
      ACE_ASSERT (this->quiet_ == 0);
      ACE_DEBUG ((LM_DEBUG,
                  "%{%I(%P|%t) EventHandler::decrement (%d)%$",
                  num, this->quiet_));
    }

  CORBA::UShort ret;
  if (--num <= 0)
    ret = 0;
  else
    {
      if (!this->quiet_)
        ACE_DEBUG ((LM_DEBUG,
                    "(%P|%t) EventHandler::decrement() "
                    "invoking Reactor::decrement(%d) %d %$",
                    num, this->quiet_));

      ret = eh->decrement (_this (env), num, env);
    }

  if (this-quiet_ == 0)
    {
      ACE_ASSERT (this->quiet_ == 0);
      ACE_DEBUG ((LM_DEBUG,
                  "%}(%P|%t) EventHandler::decrement() "
                  "returning %d%$", ret));
    }

  return ret;
}