summaryrefslogtreecommitdiff
path: root/TAO/tao/Reply_Dispatcher.cpp
blob: 230b4c623e15b2fd919a1a95879414f097fb459e (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)
  , refcount_ (1)
  , allocator_(allocator)
{
}

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


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

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

TAO_END_VERSIONED_NAMESPACE_DECL