summaryrefslogtreecommitdiff
path: root/TAO/tao/Reply_Dispatcher.cpp
blob: a2ebe2f48387ac557a6a67a5ebe5b1fff6a19659 (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
#include "tao/Reply_Dispatcher.h"

#if !defined (__ACE_INLINE__)
#include "tao/Reply_Dispatcher.inl"
#endif /* __ACE_INLINE__ */

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

// Constructor.
TAO_Reply_Dispatcher::TAO_Reply_Dispatcher (ACE_Allocator *allocator)
  // Just an invalid reply status.
  : locate_reply_status_ (GIOP::UNKNOWN_OBJECT)
  , reply_status_ (GIOP::NO_EXCEPTION)
  , refcnt_ (1)
  , allocator_(allocator)
{
}

// Destructor.
TAO_Reply_Dispatcher::~TAO_Reply_Dispatcher (void)
{
}


void
TAO_Reply_Dispatcher::intrusive_add_ref (TAO_Reply_Dispatcher* rd)
{
  if (rd != 0)
    {
      ++rd->refcnt_;
    }
}

void
TAO_Reply_Dispatcher::intrusive_remove_ref (TAO_Reply_Dispatcher* rd)
{
  if (rd != 0)
    {
      long tmp = --rd->refcnt_;
      if (tmp <= 0)
        {
          if (rd->allocator_)
            {
              ACE_DES_FREE (rd,
                            rd->allocator_->free,
                            TAO_Reply_Dispatcher);
            }
          else
            {
              delete rd;
            }
        }
    }
}

TAO_END_VERSIONED_NAMESPACE_DECL