29 INLINE CachedTypedWritableReferenceCount::
30 CachedTypedWritableReferenceCount() {
44 INLINE CachedTypedWritableReferenceCount::
62 INLINE
void CachedTypedWritableReferenceCount::
64 nassertv(
this != NULL);
73 nassertv(_cache_ref_count != -100);
75 TypedWritableReferenceCount::operator = (copy);
89 INLINE CachedTypedWritableReferenceCount::
90 ~CachedTypedWritableReferenceCount() {
91 nassertv(
this != NULL);
100 nassertv(_cache_ref_count != -100);
105 nassertv(_cache_ref_count >= 0);
117 nassertv(_cache_ref_count == 0);
123 _cache_ref_count = -100;
174 nassertr(_cache_ref_count > 0, 0);
189 return do_test_ref_count_integrity();
203 INLINE
void CachedTypedWritableReferenceCount::
204 cache_unref_only()
const {
212 nassertv(_cache_ref_count > 0);
227 template<
class RefCountType>
229 cache_unref_delete(RefCountType *ptr) {
230 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.
This is a special extension to ReferenceCount that includes dual reference counts: the standard refer...
int get_cache_ref_count() const
Returns the current reference count.
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...
virtual bool unref() const
Explicitly decrements the reference count.
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.
bool cache_unref() const
Explicitly decrements the cache reference count and the normal reference count simultaneously.