CachedTypedWritableReferenceCount

from panda3d.core import CachedTypedWritableReferenceCount
class CachedTypedWritableReferenceCount

Bases:

Bases: TypedWritableReferenceCount

This is a special extension to ReferenceCount that includes dual reference counts: the standard reference count number, which includes all references to the object, and a separate number (the cache reference count) that counts the number of references to the object just within its cache alone. When getRefCount() == getCacheRefCount(), the object is not referenced outside the cache.

The cache refs must be explicitly maintained; there is no PointerTo<> class to maintain the cache reference counts automatically. The cache reference count is automatically included in the overall reference count: calling cacheRef() and cacheUnref() automatically calls ref() and unref().

Inheritance diagram

Inheritance diagram of CachedTypedWritableReferenceCount

cacheRef()

Explicitly increments the cache reference count and the normal reference count simultaneously.

cacheUnref() bool

Explicitly decrements the cache reference count and the normal reference count simultaneously.

The return value is true if the new reference count is nonzero, false if it is zero.

property cache_ref_count int

Returns the current reference count.

getCacheRefCount() int

Returns the current reference count.

static getClassType() TypeHandle
testRefCountIntegrity() bool

Does some easy checks to make sure that the reference count isn’t completely bogus.