summaryrefslogtreecommitdiff
path: root/TAO/tao/Valuetype/ValueFactory.cpp
blob: d65e09ed1c017425b00403cfa04fbbf210ef8ba9 (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
80
81
82
83
84
// -*- C++ -*-
#include "tao/Valuetype/ValueFactory.h"
#include "ace/Guard_T.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

// Static operations in namespace CORBA.

void
CORBA::add_ref (CORBA::ValueFactoryBase *val)
{
  if (val)
    {
      val->_add_ref ();
    }
}

void
CORBA::remove_ref (CORBA::ValueFactoryBase *val)
{
  if (val)
    {
      val->_remove_ref ();
    }
}

// ===========================================================

CORBA::ValueFactoryBase::ValueFactoryBase (void)
  : _tao_reference_count_ (1)
{
}

CORBA::ValueFactoryBase::~ValueFactoryBase (void)
{
}

void
CORBA::ValueFactoryBase::_add_ref (void)
{
  ++this->_tao_reference_count_;
}

void
CORBA::ValueFactoryBase::_remove_ref (void)
{
  CORBA::ULong const new_count = --this->_tao_reference_count_;

  if (new_count == 0)
    delete this;
}

// No-op. This should never be called, but it can't be pure virtual.
CORBA::AbstractBase *
CORBA::ValueFactoryBase::create_for_unmarshal_abstract (void)
{
  return 0;
}

// =============== Template Specializations =====================
namespace TAO
{
  using namespace CORBA;

  void
  Value_Traits<ValueFactoryBase>::add_ref (ValueFactoryBase *p)
  {
    CORBA::add_ref (p);
  }

  void
  Value_Traits<ValueFactoryBase>::remove_ref (ValueFactoryBase * p)
  {
    CORBA::remove_ref (p);
  }

  void
  Value_Traits<ValueFactoryBase>::release (ValueFactoryBase * p)
  {
    CORBA::remove_ref (p);
  }
}

TAO_END_VERSIONED_NAMESPACE_DECL