CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/SimG4Core/Notification/interface/OwnIt.h

Go to the documentation of this file.
00001 #ifndef OwnIt_H
00002 #define OwnIt_H
00003 
00007 template<class T>
00008 class OwnIt {
00009 public:
00010   typedef OwnIt<T> self;
00011   OwnIt(T * p=0) : it(p){}
00012   
00013   ~OwnIt() { reset();}
00014   inline self& operator=(T * p) { if (it) delete it; it=p; return * this;}
00015   inline T * get() const { return it;}
00016   inline void reset() { if (it) { delete it; it=0; } }
00017   
00018 private:
00019   T * it;
00020   
00021 }; 
00022 
00023 #endif // OwnIt_H