00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CACHEDTYPEDWRITABLEREFERENCECOUNT_H
00016 #define CACHEDTYPEDWRITABLEREFERENCECOUNT_H
00017
00018 #include "pandabase.h"
00019
00020 #include "typedWritableReferenceCount.h"
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 class EXPCL_PANDA_PUTIL CachedTypedWritableReferenceCount : public TypedWritableReferenceCount {
00041 protected:
00042 INLINE CachedTypedWritableReferenceCount();
00043 INLINE CachedTypedWritableReferenceCount(const CachedTypedWritableReferenceCount ©);
00044 INLINE void operator = (const CachedTypedWritableReferenceCount ©);
00045 INLINE ~CachedTypedWritableReferenceCount();
00046
00047 PUBLISHED:
00048 INLINE int get_cache_ref_count() const;
00049 INLINE void cache_ref() const;
00050 INLINE bool cache_unref() const;
00051 INLINE bool test_ref_count_integrity() const;
00052
00053 protected:
00054 INLINE void cache_unref_only() const;
00055 bool do_test_ref_count_integrity() const;
00056
00057 private:
00058 AtomicAdjust::Integer _cache_ref_count;
00059
00060 public:
00061 static TypeHandle get_class_type() {
00062 return _type_handle;
00063 }
00064
00065 static void init_type() {
00066 TypedWritableReferenceCount::init_type();
00067 register_type(_type_handle, "CachedTypedWritableReferenceCount",
00068 TypedWritableReferenceCount::get_class_type());
00069 }
00070
00071 private:
00072 static TypeHandle _type_handle;
00073 };
00074
00075 template<class RefCountType>
00076 INLINE void cache_unref_delete(RefCountType *ptr);
00077
00078 #include "cachedTypedWritableReferenceCount.I"
00079
00080 #endif