36#include "foundation/PxFlags.h"
37#include "common/PxSerialFramework.h"
38#include "common/PxCollection.h"
39#include "common/PxTypeInfo.h"
41#include "foundation/PxAssert.h"
57 eOWNS_MEMORY = (1<<0),
58 eIS_RELEASABLE = (1<<1)
63PX_FLAGS_OPERATORS(PxBaseFlag::Enum, PxU16)
100 template<
class T> T* is() {
return typeMatch<T>() ?
static_cast<T*
>(
this) : NULL; }
110 template<
class T>
const T* is()
const {
return typeMatch<T>() ?
static_cast<const T*
>(
this) : NULL; }
155 virtual bool isReleasable()
const {
return mBaseFlags & PxBaseFlag::eIS_RELEASABLE; }
162 : mConcreteType(concreteType), mBaseFlags(baseFlags), mBuiltInRefCount(1) {}
169 PX_ASSERT(mBuiltInRefCount == 1);
179 virtual bool isKindOf(
const char* superClass)
const {
return !::strcmp(superClass,
"PxBase"); }
181 template<
class T>
bool typeMatch()
const
188 friend void getBinaryMetaData_PxBase(PxOutputStream& stream);
191 PxType mConcreteType;
192 PxBaseFlags mBaseFlags;
193 PxU32 mBuiltInRefCount;
226 virtual void onRefCountZero() {
delete this; }
229 PX_INLINE PxRefCounted(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
230 virtual ~PxRefCounted() {}
Base class for objects that can be members of a PxCollection.
Definition PxBase.h:73
virtual void release()=0
Releases the PxBase instance, please check documentation of release in derived class.
PX_FORCE_INLINE PxBaseFlags getBaseFlags() const
Returns PxBaseFlags.
Definition PxBase.h:144
virtual bool isReleasable() const
Whether the object is subordinate.
Definition PxBase.h:155
PX_INLINE PxBase(PxBaseFlags baseFlags)
Deserialization constructor setting base flags.
Definition PxBase.h:167
virtual bool isKindOf(const char *superClass) const
Returns whether a given type name matches with the type of this instance.
Definition PxBase.h:179
PX_FORCE_INLINE void setBaseFlags(PxBaseFlags inFlags)
Set PxBaseFlags
Definition PxBase.h:135
PX_INLINE PxBase(PxType concreteType, PxBaseFlags baseFlags)
Constructor setting concrete type and base flags.
Definition PxBase.h:161
PX_FORCE_INLINE void setBaseFlag(PxBaseFlag::Enum flag, bool value)
Set PxBaseFlag
Definition PxBase.h:126
virtual ~PxBase()
Destructor.
Definition PxBase.h:174
virtual const char * getConcreteTypeName() const =0
Returns string name of dynamic type.
PX_FORCE_INLINE PxType getConcreteType() const
Returns concrete type of object.
Definition PxBase.h:118
Container for bitfield flag variables associated with a specific enum type.
Definition PxFlags.h:73
Base class for ref-counted objects.
Definition PxBase.h:200
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxBase.h:231
virtual void acquireReference()=0
Acquires a counted reference to this object.
virtual void release()=0
Decrements the reference count of the object and releases it if the new reference count is zero.
virtual PxU32 getReferenceCount() const =0
Returns the reference count of the object.
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Flags for PxBase.
Definition PxBase.h:54
a structure containing per-type information for types inheriting from PxBase
Definition PxTypeInfo.h:113