00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef THREADSAFEPOINTERTOBASE_H
00016 #define THREADSAFEPOINTERTOBASE_H
00017
00018 #include "pandabase.h"
00019 #include "pointerToVoid.h"
00020 #include "referenceCount.h"
00021 #include "typedef.h"
00022 #include "memoryUsage.h"
00023 #include "config_express.h"
00024 #include "atomicAdjust.h"
00025
00026
00027
00028
00029
00030
00031
00032 template <class T>
00033 class ThreadSafePointerToBase : public PointerToVoid {
00034 public:
00035 typedef T To;
00036
00037 protected:
00038 INLINE ThreadSafePointerToBase(To *ptr);
00039 INLINE ThreadSafePointerToBase(const ThreadSafePointerToBase<T> ©);
00040 INLINE ~ThreadSafePointerToBase();
00041
00042 INLINE void reassign(To *ptr);
00043 INLINE void reassign(const ThreadSafePointerToBase<To> ©);
00044
00045 #ifdef DO_MEMORY_USAGE
00046 void update_type(To *ptr);
00047 #endif // DO_MEMORY_USAGE
00048
00049
00050
00051
00052
00053 PUBLISHED:
00054 INLINE void clear();
00055
00056 void output(ostream &out) const;
00057 };
00058
00059 template<class T>
00060 INLINE ostream &operator <<(ostream &out, const ThreadSafePointerToBase<T> &pointer) {
00061 pointer.output(out);
00062 return out;
00063 }
00064
00065 #include "threadSafePointerToBase.I"
00066
00067 #endif