23 INLINE CachedTypedWritableReferenceCount::
24 CachedTypedWritableReferenceCount() {
36 INLINE CachedTypedWritableReferenceCount::
50 INLINE
void CachedTypedWritableReferenceCount::
58 nassertv(_cache_ref_count != -100);
60 TypedWritableReferenceCount::operator = (copy);
70 INLINE CachedTypedWritableReferenceCount::
71 ~CachedTypedWritableReferenceCount() {
78 nassertv(_cache_ref_count != -100);
82 nassertv(_cache_ref_count >= 0);
93 nassertv(_cache_ref_count == 0);
99 _cache_ref_count = -100;
144 nassertr(_cache_ref_count > 0, 0);
157 return do_test_ref_count_integrity();
181 INLINE
void CachedTypedWritableReferenceCount::
182 cache_unref_only()
const {
190 nassertv(_cache_ref_count > 0);
202 template<
class RefCountType>
205 if (!ptr->cache_unref()) {
void cache_unref_delete(RefCountType *ptr)
This global helper function will unref the given ReferenceCount object, and if the reference count re...
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 is a special extension to ReferenceCount that includes dual reference counts: the standard refer...
void cache_ref() const
Explicitly increments the cache reference count and the normal reference count simultaneously.
bool cache_unref() const
Explicitly decrements the cache reference count and the normal reference count simultaneously.
get_cache_ref_count
Returns the current reference count.
void cache_ref_only() const
Decrements the cache reference count without affecting the normal reference count.
bool test_ref_count_integrity() const
Does some easy checks to make sure that the reference count isn't completely bogus.
void ref() const
Explicitly increments the reference count.
virtual bool unref() const
Explicitly decrements the reference count.
A base class for things which need to inherit from both TypedWritable and from ReferenceCount.