summaryrefslogtreecommitdiff
path: root/ace/CORBA_Ref.cpp
blob: 91c7231c9718e656e1305f575886504a6d90cc8a (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
// CORBA_Ref.cpp
// $Id$

#if !defined (ACE_CORBA_REF_C)
#define ACE_CORBA_REF_C

#define ACE_BUILD_DLL
#include "ace/CORBA_Ref.h"

#if !defined (__ACE_INLINE__)
#include "ace/CORBA_Ref.i"
#endif /* __ACE_INLINE__ */

template<class CORBA_REF>
ACE_CORBA_Ref<CORBA_REF>::ACE_CORBA_Ref (void)
  : ref_ (0)
{
  ACE_TRACE ("ACE_CORBA_Ref<CORBA_REF>::ACE_CORBA_Ref");
}

template<class CORBA_REF>
ACE_CORBA_Ref<CORBA_REF>::ACE_CORBA_Ref (CORBA_REF *ref)
{
  ACE_TRACE ("ACE_CORBA_Ref<CORBA_REF>::ACE_CORBA_Ref");
  if (ref != 0)
    ref_ = ref->_duplicate ();
  else
    ref_ = 0;
}

template<class CORBA_REF> CORBA_REF *
ACE_CORBA_Ref<CORBA_REF>::operator= (CORBA_REF *ref)
{
  ACE_TRACE ("ACE_CORBA_Ref<CORBA_REF>::operator=");
  if (ref_ != 0)
    ref_->_release ();
  if (ref == 0)
    {
      ref_ = 0;
      return 0;
    }
  else
    return ref_ = ref->_duplicate ();
}

template<class CORBA_REF>
ACE_CORBA_Ref<CORBA_REF>::operator CORBA_REF * (void) const
{
  ACE_TRACE ("ACE_CORBA_Ref<CORBA_REF>::operator CORBA_REF *");
  ACE_ASSERT (ref_ != 0);
  return ref_; 
}

template<class CORBA_REF> CORBA_REF *
ACE_CORBA_Ref<CORBA_REF>::operator-> (void) const
{
  ACE_TRACE ("ACE_CORBA_Ref<CORBA_REF>::operator->");
  ACE_ASSERT (ref_ != 0);
  return ref_;
}

template<class CORBA_REF> int
ACE_CORBA_Ref<CORBA_REF>::operator== (CORBA_REF *rhs) const
{
  ACE_TRACE ("ACE_CORBA_Ref<CORBA_REF>::operator==");
  // pointer comparison.
  return ref_ == rhs;
}

template<class CORBA_REF> int
ACE_CORBA_Ref<CORBA_REF>::operator!= (CORBA_REF *rhs) const
{
  ACE_TRACE ("ACE_CORBA_Ref<CORBA_REF>::operator!=");
  // pointer comparison.
  return ref_ != rhs;
}

template<class CORBA_REF>
ACE_CORBA_Ref<CORBA_REF>::~ACE_CORBA_Ref ()
{
  ACE_TRACE ("ACE_CORBA_Ref<CORBA_REF>::~ACE_CORBA_Ref");
  if (ref_ != 0)
    ref_->_release ();
}

#endif /* ACE_CORBA_REF_C */