gwnavruntime/querysystem/workingmemcontainers/statusingridbase.h Source File
Go to the documentation of this file.
16 struct BitFieldInBuffer
21 void SetWords(
KyUInt32* words) { m_offSet = (
KyUInt32)((
char*)words - (
char*)(
this)); }
25 bool IsBitSet(
KyUInt32 idx)
const {
return BitFieldUtils::IsBitSet(GetWords(), idx); }
26 void SetBit(
KyUInt32 idx)
const { BitFieldUtils::SetBit(GetWords(), idx); }
32 BitFieldInBuffer(
const BitFieldInBuffer&);
33 BitFieldInBuffer& operator=(
const BitFieldInBuffer&) {
return *
this; }
41 T* GetArrayData()
const {
return (T*)((
char*)
this + m_offSet); }
42 void SetArrayData(T* buffer) { m_offSet = (
KyUInt32)((
char*)buffer - (
char*)(
this)); }
46 T* Get(
KyUInt32 idx) {
return GetArrayData() + idx; }
47 const T* Get(
KyUInt32 idx)
const {
return GetArrayData() + idx; }
53 ArrayInBuffer(
const ArrayInBuffer<T>&);
54 ArrayInBuffer& operator=(
const ArrayInBuffer<T>&) {
return *
this; }
66 AllocatorBuffer(WorkingMemory* workingMemory)
68 m_buffer.Init(workingMemory);
72 void Init(WorkingMemory* workingMemory)
74 m_buffer.Init(workingMemory);
78 void ReleaseWorkingMemoryBuffer() { m_buffer.ReleaseBuffer(); }
82 KY_DEBUG_ASSERTN(sizeOfOneElementInBytes % 4 == 0, (
"AllocateInBufferAndMemset only accepts sizeOfOneElementInBytes that are mulptiples of 4"));
84 const KyUInt32 deltaSize = sizeOfOneElementInBytes * numberOfElements;
85 const KyUInt32 newAllocatedSize = m_allocatedSize + deltaSize;
87 if (m_buffer.Realloc(m_allocatedSize, newAllocatedSize) ==
nullptr)
90 char* ptr = GetDataPtr() + m_allocatedSize;
92 memset(ptr, memsetValue, deltaSize);
94 m_allocatedSize = newAllocatedSize;
101 return (T*)AllocInBuffer(
sizeof(T), count, memsetValue);
107 return (
KyUInt32*)AllocInBuffer(
sizeof(
KyUInt32), BitFieldUtils::GetWordsCount(bitCount), 0);
110 char* GetDataPtr()
const {
return m_buffer.GetDataPtr(); }
112 bool IsInitialized()
const {
return m_buffer.IsInitialized(); }
114 KyUInt32 GetOffset(
void* ptr)
const {
return (
KyUInt32)((
char*)ptr - GetDataPtr()); }
117 T* GetPtr(
KyUInt32 offset)
const {
return (T*)(GetDataPtr() + offset); }
120 WorkingMemContainerBase m_buffer;
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
std::uint8_t KyUInt8
uint8_t
Definition: types.h:27
#define KyUInt32MAXVAL
KyUInt32 max value
Definition: types.h:68