blob: 618198edfad3de9736758260bd1e1b3ff2cd2541 (
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
|
// $Id$
#ifndef TAO_VAROUT_T_C
#define TAO_VAROUT_T_C
#include "tao/VarOut_T.h"
#if !defined (__ACE_INLINE__)
#include "tao/VarOut_T.inl"
#endif /* __ACE_INLINE__ */
ACE_RCSID (tao,
VarOut_T,
"$Id$")
template<typename T>
TAO_Var_Base_T<T>::TAO_Var_Base_T (const TAO_Var_Base_T<T> & p)
{
if (p.ptr_)
{
ACE_NEW (this->ptr_,
T (*p.ptr_));
}
else
{
this->ptr_ = 0;
}
}
// *************************************************************
template<typename T>
TAO_Fixed_Var_T<T> &
TAO_Fixed_Var_T<T>::operator= (const TAO_Fixed_Var_T<T> & p)
{
if (this != &p)
{
if (p.ptr_ == 0)
{
delete this->ptr_;
this->ptr_ = 0;
}
else
{
T * deep_copy = 0;
ACE_NEW_RETURN (deep_copy,
T (*p.ptr_),
*this);
if (deep_copy != 0)
{
T * tmp = deep_copy;
deep_copy = this->ptr_;
this->ptr_ = tmp;
delete deep_copy;
}
}
}
return *this;
}
// Fixed-size types only.
template<typename T>
TAO_Fixed_Var_T<T> &
TAO_Fixed_Var_T<T>::operator= (const T & p)
{
if (this->ptr_ != &p)
{
delete this->ptr_;
ACE_NEW_RETURN (this->ptr_,
T (p),
*this);
}
return *this;
}
// *************************************************************
template<typename T>
TAO_Var_Var_T<T> &
TAO_Var_Var_T<T>::operator= (const TAO_Var_Var_T<T> & p)
{
if (this != &p)
{
if (p.ptr_ == 0)
{
delete this->ptr_;
this->ptr_ = 0;
}
else
{
T *deep_copy = 0;
ACE_NEW_RETURN (deep_copy,
T (*p.ptr_),
*this);
if (deep_copy != 0)
{
T * tmp = deep_copy;
deep_copy = this->ptr_;
this->ptr_ = tmp;
delete deep_copy;
}
}
}
return *this;
}
#endif /* TAO_VAROUT_T_C */
|