00001 #ifndef _LCORE_RefCountPtrT_H_ // -*-c++-*-
00002
00003 #ifdef __GNUG__
00004 # pragma interface
00005 #endif
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef _LCORE_Protocol_H_
00038 # include <LCore/Protocol.h>
00039 #endif
00040 #ifndef _EH_0_RefCounting_H_
00041 # include <LCore/RefCounting.h>
00042 #endif
00043 #ifndef _LCORE_RefCountPtr_H_
00044 # include <LCore/RefCountPtr.h>
00045 #endif
00046
00047 #define _LCORE_RefCountPtrT_H_
00048
00049 namespace strmod {
00050 namespace lcore {
00051
00052 template <class T>
00053 class RefCountPtrT : public RefCountPtr {
00054 public:
00055 RefCountPtrT(const RefCountPtrT<T> &b) : RefCountPtr(b) { }
00056 inline RefCountPtrT(T *rfptr = 0);
00057
00058 inline T &operator *() const;
00059 inline T *operator ->() const;
00060
00061 inline T *GetPtr() const;
00062
00063 inline const RefCountPtrT<T> &operator =(const RefCountPtrT<T> &b);
00064 inline const RefCountPtrT<T> &operator =(const RefCountPtr &b);
00065 inline const RefCountPtrT<T> &operator =(T *b);
00066
00067 protected:
00068 inline virtual ReferenceCounting *i_CheckType(ReferenceCounting *p) const;
00069 };
00070
00071
00072
00073 template <class T>
00074 inline RefCountPtrT<T>::RefCountPtrT(T *rfptr) : RefCountPtr(rfptr)
00075 {
00076 }
00077
00078 template <class T>
00079 inline T &RefCountPtrT<T>::operator *() const
00080 {
00081 return(*GetPtr());
00082 }
00083
00084 template <class T>
00085 inline T *RefCountPtrT<T>::operator ->() const
00086 {
00087 return(GetPtr());
00088 }
00089
00090 template <class T>
00091 inline T *RefCountPtrT<T>::GetPtr() const
00092 {
00093 return(static_cast<T *>(RefCountPtr::GetPtr()));
00094 }
00095
00096 template <class T>
00097 inline const RefCountPtrT<T> &
00098 RefCountPtrT<T>::operator =(const RefCountPtrT<T> &b)
00099 {
00100 RefCountPtr::operator =(b);
00101 return(*this);
00102 }
00103
00104 template <class T>
00105 inline const RefCountPtrT<T> &
00106 RefCountPtrT<T>::operator =(const RefCountPtr &b)
00107 {
00108 RefCountPtr::operator =(b);
00109 return(*this);
00110 }
00111
00112 template <class T>
00113 inline const RefCountPtrT<T> &
00114 RefCountPtrT<T>::operator =(T *b)
00115 {
00116 RefCountPtr::operator =(b);
00117 return(*this);
00118 }
00119
00120 template <class T>
00121 inline ReferenceCounting *
00122 RefCountPtrT<T>::i_CheckType(ReferenceCounting *p) const
00123 {
00124 return(p->AreYouA(T::identifier) ? p : 0);
00125 }
00126
00127 }
00128 }
00129
00130 #endif