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;
106 INLINE
int CachedTypedWritableReferenceCount::
107 get_cache_ref_count()
const {
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()) {
bool test_ref_count_integrity() const
Does some easy checks to make sure that the reference count isn't completely bogus.
void cache_unref_delete(RefCountType *ptr)
This global helper function will unref the given ReferenceCount object, and if the reference count re...
This is a special extension to ReferenceCount that includes dual reference counts: the standard refer...
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,...
void cache_ref_only() const
Decrements the cache reference count without affecting the normal reference count.
bool cache_unref() const
Explicitly decrements the cache reference count and the normal reference count simultaneously.
void cache_ref() const
Explicitly increments the cache reference count and the normal reference count simultaneously.
static Integer get(const Integer &var)
Atomically retrieves the snapshot value of the indicated variable.
A base class for things which need to inherit from both TypedWritable and from ReferenceCount.
void ref() const
Explicitly increments the reference count.
virtual bool unref() const
Explicitly decrements the reference count.