00001 #ifndef _CTBownedObjPtr_HXX 00002 #define _CTBownedObjPtr_HXX 1 00003 00008 /*----------------------------------------------------------------------------*/ 00009 /* C Tool Box: Designed and implemented by: */ 00010 /* Walter F.J. Mueller Gesellschaft fuer Schwerionenforschung (GSI) */ 00011 /* Planckstrasse 1, D-64291 Darmstadt, Germany */ 00012 /* Email: W.F.J.Mueller@gsi.de */ 00013 /* WWW: http://www-kp3.gsi.de/www/kp3/people/mueller.html */ 00014 /*------------------------------------------+---------------------------------*/ 00015 00016 template <class T> 00017 class CTBownedObjPtr { 00018 00019 public: 00020 CTBownedObjPtr(); 00021 CTBownedObjPtr(CTBownedObjPtr<T>& rhs); 00022 CTBownedObjPtr(T* p); 00023 00024 ~CTBownedObjPtr(); 00025 00026 T* Release(); 00027 bool Equal(const CTBownedObjPtr<T>& rhs) const; 00028 void ToStream(ostream& os) const; 00029 00030 CTBownedObjPtr<T>& operator=(CTBownedObjPtr<T>& rhs); 00031 CTBownedObjPtr<T>& operator=(T* rhs); 00032 00033 T& operator*() const; 00034 T* operator->() const; 00035 00036 bool operator !() const; 00037 operator void*() const; 00038 00039 protected: 00040 00041 T* mp; 00042 }; 00043 00044 template <class T> 00045 bool operator==(const CTBownedObjPtr<T>& lhs, const CTBownedObjPtr<T>& rhs); 00046 00047 template <class T> 00048 ostream& operator<<(ostream& os, const CTBownedObjPtr<T>& obj); 00049 00050 // Notes: 00051 // -- proofed: 12-may-1999(0) 00052 00053 // the implementation is fully inlined and always included here 00054 #include "CTBownedObjPtr.icc" 00055 00056 #endif