bool SC_PolyStore::Alloc(int np, int npP, int npI) { DeAlloc(); pointData.SetFixed(); pointZ.SetFixed(); polyPointIndx.SetFixed(); try { polyStart.Alloc(np); polyN.AllocAndFill(np, 0); polyN.SetEmpty(); pointData.Alloc(npP); pointZ.Alloc(npP); polyPointIndx.Alloc(npI); } catch (SC_Array::AllocationError) { DeAlloc(); return false; } return true; }
bool DC_XYData::CreateFrom(const SC_DoubleArray& inX, const SC_DoubleArray& inY) { try { if (xData.Size() != yData.Size()) { int maxSize = xData.Size(); if (yData.Size() > maxSize) maxSize = yData.Size(); if (maxSize < 10) maxSize = 10; xData.Alloc(maxSize); yData.Alloc(maxSize); } xData = inX; yData = inY; } catch (SC_Array::AllocationError& ) { DeAlloc(); return false; } CleanUp(); return ! IsEmpty(); }
void CAudBuffer::Alloc(const size_t size) { DeAlloc(); m_buffer = (uint8_t*)malloc_aligned(size, 16); m_buffer_size = size; m_buffer_pos = 0; }
void CAEBuffer::Alloc(const size_t size) { DeAlloc(); m_buffer = (uint8_t*)_aligned_malloc(size, 16); m_bufferSize = size; m_bufferPos = 0; }
SC_PolyStore& SC_PolyStore::operator= (const SC_PolyStore& a) { if (this != &a) { DeAlloc(); pointData = a.pointData; pointZ = a.pointZ; polyPointIndx = a.polyPointIndx; polyStart = a.polyStart; polyN = a.polyN; maxPolyPoint = a.maxPolyPoint; } return *this; }
bool DC_XYData::Alloc(int nRow) { try { xData.Alloc(nRow); yData.Alloc(nRow); } catch (SC_Array::AllocationError& ) { DeAlloc(); return false; } return true; }
/***************************************************************************** * Function - CheckMemoryAvailable * DESCRIPTION: Allocates and DeAllocates a number of bytes * * Return: The number of bytes that could be allocated * *****************************************************************************/ int TestAlloc::CheckMemoryAvailable(int bytes) { static int old_memory = 0; static int difference = 0; static int diff_count = 0; int memory_allocated = Alloc(bytes); int memory_deallocated = DeAlloc(); if (memory_allocated != memory_deallocated) { memory_deallocated = 0; // Realy bad, should not happen } difference = memory_allocated - old_memory; if (difference != 0) { // Ok in case of call from different tasks or if all memory is used diff_count++; old_memory = memory_allocated; } return memory_allocated; }
SC_PolyStore::~SC_PolyStore() { DeAlloc(); }
DC_XYData :: ~DC_XYData() { DeAlloc(); }
CAudBuffer::~CAudBuffer() { DeAlloc(); }
CAEBuffer::~CAEBuffer() { DeAlloc(); }