mirror of
https://github.com/thunderbrewhq/common.git
synced 2025-12-12 03:02:29 +00:00
feat(objectalloc): add copy constructor for CObjectHeapList
This commit is contained in:
parent
5d0182796e
commit
def0513800
2 changed files with 24 additions and 1 deletions
|
|
@ -1,6 +1,26 @@
|
||||||
#include "common/objectalloc/CObjectHeapList.hpp"
|
#include "common/objectalloc/CObjectHeapList.hpp"
|
||||||
#include <storm/Error.hpp>
|
#include <storm/Error.hpp>
|
||||||
|
|
||||||
|
CObjectHeapList::CObjectHeapList(const CObjectHeapList& list) {
|
||||||
|
if (this == &list) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->m_heaps.Set(list.m_heaps.Count(), list.m_heaps.Ptr());
|
||||||
|
|
||||||
|
this->m_objSize = list.m_objSize;
|
||||||
|
this->m_objsPerBlock = list.m_objsPerBlock;
|
||||||
|
this->m_numFullHeaps = list.m_numFullHeaps;
|
||||||
|
this->m_hasEmptyHeaps = list.m_hasEmptyHeaps;
|
||||||
|
this->uint20 = list.uint20;
|
||||||
|
this->m_fullestHeap = list.m_fullestHeap;
|
||||||
|
memcpy(this->m_heapName, list.m_heapName, sizeof(this->m_heapName));
|
||||||
|
this->uint78 = list.uint78;
|
||||||
|
this->uint7C = list.uint7C;
|
||||||
|
this->uint80 = list.uint80;
|
||||||
|
this->m_freeEmptyHeaps = list.m_freeEmptyHeaps;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CObjectHeapList::New(uint32_t* index, void** obj, bool zero) {
|
int32_t CObjectHeapList::New(uint32_t* index, void** obj, bool zero) {
|
||||||
STORM_ASSERT(index);
|
STORM_ASSERT(index);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,16 @@ class CObjectHeapList {
|
||||||
uint32_t m_hasEmptyHeaps = 0;
|
uint32_t m_hasEmptyHeaps = 0;
|
||||||
uint32_t uint20 = 0;
|
uint32_t uint20 = 0;
|
||||||
uint32_t m_fullestHeap = 0;
|
uint32_t m_fullestHeap = 0;
|
||||||
char m_heapName[80];
|
char m_heapName[80] = {};
|
||||||
uint32_t uint78 = 0;
|
uint32_t uint78 = 0;
|
||||||
uint32_t uint7C = 0;
|
uint32_t uint7C = 0;
|
||||||
uint32_t uint80 = 0;
|
uint32_t uint80 = 0;
|
||||||
uint8_t m_freeEmptyHeaps = 1;
|
uint8_t m_freeEmptyHeaps = 1;
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
CObjectHeapList() = default;
|
||||||
|
CObjectHeapList(const CObjectHeapList& list);
|
||||||
|
CObjectHeapList& operator=(const CObjectHeapList& list) = delete;
|
||||||
int32_t New(uint32_t* index, void** obj, bool zero);
|
int32_t New(uint32_t* index, void** obj, bool zero);
|
||||||
void* Ptr(uint32_t index);
|
void* Ptr(uint32_t index);
|
||||||
void Delete(uint32_t index);
|
void Delete(uint32_t index);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue