PxFlags

Defined in include/foundation/PxFlags.h

template<typename enumtype, typename storagetype = uint32_t>
class PxFlags

Container for bitfield flag variables associated with a specific enum type.

This allows for type safe manipulation for bitfields.

Example

enum that defines each bit… struct MyEnum { enum Enum { eMAN = 1, eBEAR = 2, ePIG = 4, }; };

implements some convenient global operators. PX_FLAGS_OPERATORS(MyEnum::Enum, uint8_t);

PxFlags<MyEnum::Enum, uint8_t> myFlags; myFlags |= MyEnum::eMAN; myFlags |= MyEnum::eBEAR | MyEnum::ePIG; if(myFlags & MyEnum::eBEAR) { doSomething(); }

Public Types

typedef storagetype InternalType

Public Functions

inline explicit PxFlags(const PxEMPTY)
inline PxFlags(void)
inline PxFlags(enumtype e)
inline PxFlags(const PxFlags<enumtype, storagetype> &f)
inline explicit PxFlags(storagetype b)
inline bool operator==(enumtype e) const
inline bool operator==(const PxFlags<enumtype, storagetype> &f) const
inline bool operator==(bool b) const
inline bool operator!=(enumtype e) const
inline bool operator!=(const PxFlags<enumtype, storagetype> &f) const
inline PxFlags<enumtype, storagetype> &operator=(const PxFlags<enumtype, storagetype> &f)
inline PxFlags<enumtype, storagetype> &operator=(enumtype e)
inline PxFlags<enumtype, storagetype> &operator|=(enumtype e)
inline PxFlags<enumtype, storagetype> &operator|=(const PxFlags<enumtype, storagetype> &f)
inline PxFlags<enumtype, storagetype> operator|(enumtype e) const
inline PxFlags<enumtype, storagetype> operator|(const PxFlags<enumtype, storagetype> &f) const
inline PxFlags<enumtype, storagetype> &operator&=(enumtype e)
inline PxFlags<enumtype, storagetype> &operator&=(const PxFlags<enumtype, storagetype> &f)
inline PxFlags<enumtype, storagetype> operator&(enumtype e) const
inline PxFlags<enumtype, storagetype> operator&(const PxFlags<enumtype, storagetype> &f) const
inline PxFlags<enumtype, storagetype> &operator^=(enumtype e)
inline PxFlags<enumtype, storagetype> &operator^=(const PxFlags<enumtype, storagetype> &f)
inline PxFlags<enumtype, storagetype> operator^(enumtype e) const
inline PxFlags<enumtype, storagetype> operator^(const PxFlags<enumtype, storagetype> &f) const
inline PxFlags<enumtype, storagetype> operator~(void) const
inline operator bool(void) const
inline operator uint8_t(void) const
inline operator uint16_t(void) const
inline operator uint32_t(void) const
inline void clear(enumtype e)
inline void raise(enumtype e)
inline bool isSet(enumtype e) const
inline PxFlags<enumtype, storagetype> &setAll(enumtype e)

Friends

inline friend PxFlags<enumtype, storagetype> operator&(enumtype a, PxFlags<enumtype, storagetype> &b)