00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef NODEREFERENCECOUNT_H
00016 #define NODEREFERENCECOUNT_H
00017
00018 #include "pandabase.h"
00019
00020 #include "referenceCount.h"
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class EXPCL_PANDAEXPRESS NodeReferenceCount : public ReferenceCount {
00042 protected:
00043 INLINE NodeReferenceCount();
00044 INLINE NodeReferenceCount(const NodeReferenceCount ©);
00045 INLINE void operator = (const NodeReferenceCount ©);
00046 INLINE ~NodeReferenceCount();
00047
00048 PUBLISHED:
00049 INLINE int get_node_ref_count() const;
00050 INLINE void node_ref() const;
00051 INLINE bool node_unref() const;
00052 INLINE bool test_ref_count_integrity() const;
00053
00054 protected:
00055 INLINE void node_unref_only() const;
00056
00057 bool do_test_ref_count_integrity() const;
00058
00059 private:
00060 AtomicAdjust::Integer _node_ref_count;
00061
00062 public:
00063 static TypeHandle get_class_type() {
00064 return _type_handle;
00065 }
00066
00067 static void init_type() {
00068 ReferenceCount::init_type();
00069 register_type(_type_handle, "NodeReferenceCount",
00070 ReferenceCount::get_class_type());
00071 }
00072
00073 private:
00074 static TypeHandle _type_handle;
00075 };
00076
00077 template<class RefCountType>
00078 INLINE void node_unref_delete(RefCountType *ptr);
00079
00080
00081
00082
00083
00084
00085 template<class Base>
00086 class NodeRefCountObj : public NodeReferenceCount, public Base {
00087 public:
00088 INLINE NodeRefCountObj();
00089 INLINE NodeRefCountObj(const Base ©);
00090 ALLOC_DELETED_CHAIN(NodeRefCountObj<Base>);
00091
00092 static TypeHandle get_class_type() {
00093 return _type_handle;
00094 }
00095 static void init_type();
00096
00097 private:
00098 static TypeHandle _type_handle;
00099 };
00100
00101 #include "nodeReferenceCount.I"
00102
00103 #endif
00104