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());
bool node_unref() const
Explicitly decrements the node reference count and the normal reference count simultaneously.
static void inc(Integer &var)
Atomically increments the indicated variable.
static bool dec(Integer &var)
Atomically decrements the indicated variable and returns true if the new value is nonzero,...
bool test_ref_count_integrity() const
Does some easy checks to make sure that the reference count isn't completely bogus.
int get_node_ref_count() const
Returns the current reference count.
This class specializes ReferenceCount to add an additional counter, called node_ref_count,...
void node_unref_only() const
Decrements the node reference count without affecting the normal reference count.
void node_unref_delete(RefCountType *ptr)
This global helper function will unref the given ReferenceCount object, and if the reference count re...
This works like RefCountObj, but it inherits from NodeReferenceCount instead of ReferenceCount.
void node_ref() const
Explicitly increments the node reference count and the normal reference count simultaneously.
static Integer get(const Integer &var)
Atomically retrieves the snapshot value of the indicated variable.
void ref() const
Explicitly increments the reference count.
A base class for all things that want to be reference-counted.
TypeHandle is the identifier used to differentiate C++ class types.
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...
virtual bool unref() const
Explicitly decrements the reference count.