26 INLINE NodeReferenceCount::
27 NodeReferenceCount() {
39 INLINE NodeReferenceCount::
53 INLINE
void NodeReferenceCount::
61 nassertv(_node_ref_count != -100);
63 ReferenceCount::operator = (copy);
73 INLINE NodeReferenceCount::
74 ~NodeReferenceCount() {
81 nassertv(_node_ref_count != -100);
85 nassertv(_node_ref_count >= 0);
96 nassertv(_node_ref_count == 0);
102 _node_ref_count = -100;
151 return do_test_ref_count_integrity();
171 nassertv(_node_ref_count > 0);
183 template<
class RefCountType>
186 if (!ptr->node_unref()) {
216 #if defined(HAVE_RTTI) && !defined(__EDG__)
218 std::string base_name =
typeid(Base).name();
220 std::string base_name =
"unknown";
225 ReferenceCount::init_type();
228 base_type, ReferenceCount::get_class_type());
static bool dec(Integer &var)
Atomically decrements the indicated variable and returns true if the new value is nonzero,...
static void inc(Integer &var)
Atomically increments the indicated variable.
static Integer get(const Integer &var)
Atomically retrieves the snapshot value of the indicated variable.
This works like RefCountObj, but it inherits from NodeReferenceCount instead of ReferenceCount.
This class specializes ReferenceCount to add an additional counter, called node_ref_count,...
void node_ref() const
Explicitly increments the node reference count and the normal reference count simultaneously.
bool test_ref_count_integrity() const
Does some easy checks to make sure that the reference count isn't completely bogus.
bool node_unref() const
Explicitly decrements the node reference count and the normal reference count simultaneously.
int get_node_ref_count() const
Returns the current reference count.
void node_unref_only() const
Decrements the node reference count without affecting the normal reference count.
A base class for all things that want to be reference-counted.
void ref() const
Explicitly increments the reference count.
virtual bool unref() const
Explicitly decrements the reference count.
TypeHandle is the identifier used to differentiate C++ class types.
void node_unref_delete(RefCountType *ptr)
This global helper function will unref the given ReferenceCount object, and if the reference count re...
TypeHandle register_dynamic_type(const std::string &name)
This is essentially similar to register_type(), except that it doesn't store a reference to any TypeH...