00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef WEAKPOINTERTOBASE_H
00016 #define WEAKPOINTERTOBASE_H
00017
00018 #include "pandabase.h"
00019 #include "pointerToBase.h"
00020 #include "weakPointerToVoid.h"
00021
00022
00023
00024
00025
00026
00027
00028 template <class T>
00029 class WeakPointerToBase : public WeakPointerToVoid {
00030 public:
00031 typedef T To;
00032
00033 protected:
00034 INLINE WeakPointerToBase(To *ptr);
00035 INLINE WeakPointerToBase(const PointerToBase<T> ©);
00036 INLINE WeakPointerToBase(const WeakPointerToBase<T> ©);
00037 INLINE ~WeakPointerToBase();
00038
00039 void reassign(To *ptr);
00040 INLINE void reassign(const PointerToBase<To> ©);
00041 INLINE void reassign(const WeakPointerToBase<To> ©);
00042
00043
00044
00045
00046
00047 public:
00048
00049
00050 #ifndef CPPPARSER
00051 #ifndef WIN32_VC
00052 INLINE bool operator == (const To *other) const;
00053 INLINE bool operator != (const To *other) const;
00054 INLINE bool operator > (const To *other) const;
00055 INLINE bool operator <= (const To *other) const;
00056 INLINE bool operator >= (const To *other) const;
00057 INLINE bool operator == (To *other) const;
00058 INLINE bool operator != (To *other) const;
00059 INLINE bool operator > (To *other) const;
00060 INLINE bool operator <= (To *other) const;
00061 INLINE bool operator >= (To *other) const;
00062
00063 INLINE bool operator == (const WeakPointerToBase<To> &other) const;
00064 INLINE bool operator != (const WeakPointerToBase<To> &other) const;
00065 INLINE bool operator > (const WeakPointerToBase<To> &other) const;
00066 INLINE bool operator <= (const WeakPointerToBase<To> &other) const;
00067 INLINE bool operator >= (const WeakPointerToBase<To> &other) const;
00068
00069 INLINE bool operator == (const PointerToBase<To> &other) const;
00070 INLINE bool operator != (const PointerToBase<To> &other) const;
00071 INLINE bool operator > (const PointerToBase<To> &other) const;
00072 INLINE bool operator <= (const PointerToBase<To> &other) const;
00073 INLINE bool operator >= (const PointerToBase<To> &other) const;
00074 #endif // WIN32_VC
00075 INLINE bool operator < (const To *other) const;
00076 INLINE bool operator < (const WeakPointerToBase<To> &other) const;
00077 INLINE bool operator < (const PointerToBase<To> &other) const;
00078 #endif // CPPPARSER
00079
00080 PUBLISHED:
00081 INLINE void clear();
00082 INLINE void refresh() const;
00083
00084 void output(ostream &out) const;
00085 };
00086
00087 template<class T>
00088 INLINE ostream &operator <<(ostream &out, const WeakPointerToBase<T> &pointer) {
00089 pointer.output(out);
00090 return out;
00091 }
00092
00093 #include "weakPointerToBase.I"
00094
00095 #endif