summaryrefslogtreecommitdiff
path: root/TAO/tao/ValueFactory.i
blob: bbb6ad561fe145c95be7118cbe1eb423e77eceec (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// -*- C++ -*-
//
// $Id$

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

ACE_INLINE void
CORBA::ValueFactoryBase::_add_ref (void)
{
  ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->_tao_reference_count_lock_);
  ++_tao_reference_count_;
}

ACE_INLINE void
CORBA::ValueFactoryBase::_remove_ref (void)
{
  {
    ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->_tao_reference_count_lock_);
    -- this->_tao_reference_count_;
    if (this->_tao_reference_count_ != 0)
      return;
  }
  delete this;
}

// *************************************************************
// Inline operations for class CORBA::ValueFactoryBase_var
// *************************************************************

ACE_INLINE
CORBA::ValueFactoryBase_var::ValueFactoryBase_var (void)
  : ptr_ (0)
{
}

ACE_INLINE
CORBA::ValueFactoryBase_var::ValueFactoryBase_var (
    CORBA::ValueFactoryBase *p
  )
  : ptr_ (p)
{
}

ACE_INLINE
CORBA::ValueFactoryBase_var::~ValueFactoryBase_var (void)
{
  if (this->ptr_ != 0)
    {
      this->ptr_->_remove_ref ();
    }
}

ACE_INLINE CORBA::ValueFactoryBase *
CORBA::ValueFactoryBase_var::ptr (void) const
{
  return this->ptr_;
}

ACE_INLINE
CORBA::ValueFactoryBase_var::ValueFactoryBase_var (
    const CORBA::ValueFactoryBase_var &p
  )
  : ptr_ (p.ptr_)
{
  p.ptr_->_add_ref ();
}

ACE_INLINE CORBA::ValueFactoryBase_var &
CORBA::ValueFactoryBase_var::operator= (CORBA::ValueFactoryBase *p)
{
  if (this->ptr_ != 0)
    {
      this->ptr_->_remove_ref ();
    }

  this->ptr_ = p;
  return *this;
}

ACE_INLINE CORBA::ValueFactoryBase_var &
CORBA::ValueFactoryBase_var::operator= (const CORBA::ValueFactoryBase_var &p)
{
  if (this != &p)
    {
      if (this->ptr_ != 0)
        {
          this->ptr_->_remove_ref ();
        }

      p.ptr_->_add_ref ();
      this->ptr_ = p.ptr_;
    }

  return *this;
}

ACE_INLINE CORBA::ValueFactoryBase *
CORBA::ValueFactoryBase_var::operator-> (void) const
{
  return this->ptr_;
}

ACE_INLINE CORBA::ValueFactoryBase *
CORBA::ValueFactoryBase_var::in (void) const
{
  return this->ptr_;
}

ACE_INLINE CORBA::ValueFactoryBase *&
CORBA::ValueFactoryBase_var::inout (void)
{
  return this->ptr_;
}

ACE_INLINE CORBA::ValueFactoryBase *&
CORBA::ValueFactoryBase_var::out (void)
{
  if (this->ptr_ != 0)
    {
      this->ptr_->_remove_ref ();
    }

  this->ptr_ = 0;
  return this->ptr_;
}

ACE_INLINE CORBA::ValueFactoryBase *
CORBA::ValueFactoryBase_var::_retn (void)
{
  // Yield ownership of valuebase.
  CORBA::ValueFactoryBase *val = this->ptr_;
  this->ptr_ = 0;
  return val;
}