Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

autocloner.h

Go to the documentation of this file.
00001 
00002 
00004 template <class T> class AutoCloner {
00006     T * t;
00007 public:
00009     AutoCloner() {t=NULL;}
00011     AutoCloner (T * t){this->t =t;}
00013     AutoCloner (const AutoCloner <T> &o) {*this = o;}
00015     AutoCloner<T> & operator = (const T &t){
00016         this->t = t.clone();
00017         return *this;
00018     }
00020     AutoCloner<T> & operator = (const T* t){
00021         if (t)
00022             return *this = *t;
00023         else this->t=0;
00024         return *this;
00025     }
00027     AutoCloner<T> & operator = (const AutoCloner <T> &o){
00028         return *this = o.t;
00029     }
00031     ~AutoCloner(){if (t) delete t;}
00033     const T* operator -> () const {return t;}
00035     T* operator -> () {return t;}
00037     bool IsNull() const {return t==0;}
00039     bool NotNull() const {return !isNull();}
00040 };
00041 

Generated on Mon Jul 7 21:13:44 2003 for Ethereal by doxygen1.2.15