29#ifndef CM_REFCOUNTABLE_H
30#define CM_REFCOUNTABLE_H
32#include "foundation/PxAssert.h"
33#include "foundation/PxAtomic.h"
34#include "foundation/PxAllocator.h"
35#include "common/PxBase.h"
50 void preExportDataReset()
57 volatile PxI32* val =
reinterpret_cast<volatile PxI32*
>(&mBuiltInRefCount);
58 PxAtomicIncrement(val);
60 PX_ASSERT(mBuiltInRefCount>1);
65 PX_ASSERT(mBuiltInRefCount>0);
66 volatile PxI32* val =
reinterpret_cast<volatile PxI32*
>(&mBuiltInRefCount);
67 if(physx::PxAtomicDecrement(val) == 0)
73 return mBuiltInRefCount;
79 PX_FORCE_INLINE void RefCountable_decRefCount(PxRefCounted& base) {
static_cast<RefCountableExt&
>(base).decRefCount(); }
80 PX_FORCE_INLINE PxU32 RefCountable_getRefCount(
const PxRefCounted& base) {
return static_cast<const RefCountableExt&
>(base).getRefCount(); }
96 void preExportDataReset() { mRefCount = 1; }
100 : mRefCount(PxI32(initialCount))
102 PX_ASSERT(mRefCount!=0);
118 physx::PxAtomicIncrement(&mRefCount);
120 PX_ASSERT(mRefCount>1);
125 PX_ASSERT(mRefCount>0);
126 if(physx::PxAtomicDecrement(&mRefCount) == 0)
132 return PxU32(mRefCount);
135 volatile PxI32 mRefCount;
Definition CmRefCountable.h:45
Definition CmRefCountable.h:86
virtual void onRefCountZero()
Definition CmRefCountable.h:111
Output stream class for I/O.
Definition PxIO.h:114
Base class for ref-counted objects.
Definition PxBase.h:200
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PxEMPTY
Definition Px.h:87