| 57 | */ |
| 58 | template<class Allocator> |
| 59 | class BitMapBase : public Ps::UserAllocated |
| 60 | { |
| 61 | //= ATTENTION! ===================================================================================== |
| 62 | // Changing the data layout of this class breaks the binary serialization format. See comments for |
| 63 | // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData |
| 64 | // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION |
| 65 | // accordingly. |
| 66 | //================================================================================================== |
| 67 | |
| 68 | PX_NOCOPY(BitMapBase) |
| 69 | |
| 70 | public: |
| 71 | |
| 72 | // PX_SERIALIZATION |
| 73 | /* todo: explicit */ BitMapBase(const PxEMPTY) |
| 74 | { |
| 75 | if(mMap) |
| 76 | mWordCount |= PX_SIGN_BITMASK; |
| 77 | } |
| 78 | |
| 79 | void exportExtraData(PxSerializationContext& stream, void*) |
| 80 | { |
| 81 | if(mMap && getWordCount()) |
| 82 | { |
| 83 | stream.alignData(PX_SERIAL_ALIGN); |
| 84 | stream.writeData(mMap, getWordCount()*sizeof(PxU32)); |
| 85 | } |
| 86 | } |
| 87 | void importExtraData(PxDeserializationContext& context) |
| 88 | { |
| 89 | if(mMap && getWordCount()) |
| 90 | mMap = context.readExtraData<PxU32, PX_SERIAL_ALIGN>(getWordCount()); |
| 91 | } |
| 92 | //~PX_SERIALIZATION |
| 93 | |
| 94 | //sschirm: function for placement new. Almost the same as importExtraData above, but lets you set word count and map after default construction |
| 95 | void importData(PxU32 worldCount, PxU32* words) |
| 96 | { |
| 97 | PX_ASSERT(mWordCount == 0 && !mMap); |
| 98 | mMap = words; |
| 99 | mWordCount = worldCount | PX_SIGN_BITMASK; |
| 100 | } |
| 101 | |
| 102 | PX_INLINE BitMapBase(Allocator& allocator) : mMap(0), mWordCount(0), mAllocator(allocator) {} |
| 103 | |
| 104 | PX_INLINE BitMapBase() : mMap(0), mWordCount(0) {} |
| 105 | |
| 106 | PX_INLINE ~BitMapBase() |
| 107 | { |
| 108 | if(mMap && !isInUserMemory()) |
| 109 | mAllocator.deallocate(mMap); |
| 110 | mMap = NULL; |
| 111 | } |
| 112 | |
| 113 | PX_INLINE Allocator& getAllocator() { return mAllocator; } |
| 114 | |
| 115 | PX_INLINE void growAndSet(PxU32 index) |
| 116 | { |
nothing calls this directly
no test coverage detected