00001 // Seq_Var_T.cpp,v 1.6 2006/04/19 08:45:04 jwillemsen Exp 00002 00003 #ifndef TAO_SEQ_VAR_T_CPP 00004 #define TAO_SEQ_VAR_T_CPP 00005 00006 #include "tao/Seq_Var_T.h" 00007 00008 #if !defined (__ACE_INLINE__) 00009 #include "tao/Seq_Var_T.inl" 00010 #endif /* __ACE_INLINE__ */ 00011 00012 #include "ace/OS_Memory.h" 00013 00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00015 00016 template<typename T> 00017 TAO_Seq_Var_Base_T<T>::TAO_Seq_Var_Base_T ( 00018 const TAO_Seq_Var_Base_T<T> & p) 00019 : ptr_ (p.ptr_ ? new T (*p.ptr_) : 0) 00020 { 00021 } 00022 00023 // **************************************************************************** 00024 00025 template<typename T> 00026 TAO_FixedSeq_Var_T<T> & 00027 TAO_FixedSeq_Var_T<T>::operator= ( 00028 const TAO_FixedSeq_Var_T<T> & p) 00029 { 00030 // Strongly exception safe assignment using copy and non-throwing 00031 // swap technique. 00032 TAO_FixedSeq_Var_T<T> tmp (p); 00033 00034 T * old_ptr = this->ptr_; 00035 this->ptr_ = tmp.ptr_; 00036 tmp.ptr_ = old_ptr; 00037 00038 return *this; 00039 } 00040 00041 // Fixed-size types only. 00042 template<typename T> 00043 TAO_FixedSeq_Var_T<T> & 00044 TAO_FixedSeq_Var_T<T>::operator= (const T & p) 00045 { 00046 // Strongly exception safe assignment using copy and non-throwing 00047 // swap technique. 00048 TAO_FixedSeq_Var_T<T> tmp (p); 00049 00050 T * old_ptr = this->ptr_; 00051 this->ptr_ = tmp.ptr_; 00052 tmp.ptr_ = old_ptr; 00053 00054 return *this; 00055 } 00056 00057 // **************************************************************************** 00058 00059 template<typename T> 00060 TAO_VarSeq_Var_T<T> & 00061 TAO_VarSeq_Var_T<T>::operator= (const TAO_VarSeq_Var_T<T> & p) 00062 { 00063 // Strongly exception safe assignment using copy and non-throwing 00064 // swap technique. 00065 TAO_VarSeq_Var_T<T> tmp (p); 00066 00067 T * old_ptr = this->ptr_; 00068 this->ptr_ = tmp.ptr_; 00069 tmp.ptr_ = old_ptr; 00070 00071 return *this; 00072 } 00073 00074 TAO_END_VERSIONED_NAMESPACE_DECL 00075 00076 #endif /* TAO_SEQ_VAR_T_CPP */