template<class TA> void DynObjArray_cl<TA>::Resize(unsigned int newSize) { if (newSize==size) return; TA *tempData; int copySize; if (newSize > size) copySize = size; else copySize = newSize; tempData = data; if (newSize > 0) { data = (TA*)VBaseAlloc(sizeof(TA)*newSize); VConstructElements<TA>(data, newSize); } else data = NULL; int oldSize = size; size = newSize; Init(defaultValue); if ( (size > 0) && (tempData != NULL) ) { for (int i = 0; i < copySize; i++) data[i] = tempData[i]; } if (tempData) { VDestructElements<TA>(tempData, oldSize); VBaseDealloc(tempData); } }
template<class TA> void DynArray_cl<TA>::Resize(unsigned int newSize) { if (newSize==size) return; TA *tempData; int copySize; if (newSize > size) copySize = size; else copySize = newSize; tempData = data; if (newSize > 0) data = (TA*)VBaseAlloc(sizeof(TA)*newSize); else data = NULL; size = newSize; Init(defaultValue); if ( (size > 0) && (tempData != NULL) ) { for (int i = 0; i < copySize; i++) data[i] = tempData[i]; } if (tempData) VBaseDealloc((void*)tempData); }
template<class TA> DynArray_cl<TA>::DynArray_cl(unsigned int initSize) { size = initSize; if (size > 0) data = (TA*)VBaseAlloc(sizeof(TA)*size); else data = NULL; }
template<class TA> DynArray_cl<TA>::DynArray_cl(unsigned int initSize, const TA &defaultElementValue) { size = initSize; // cant be less then zero if (size < 0) size = 0; if (size > 0) data = (TA*)VBaseAlloc(sizeof(TA)*size); else data = NULL; Init(defaultElementValue); }
template<class TA> DynObjArray_cl<TA>::DynObjArray_cl(unsigned int initSize) { size = initSize; if (size > 0) { data = (TA*)VBaseAlloc(sizeof(TA)*size); VConstructElements<TA>(data, initSize); } else data = NULL; }
template<class TA> DynArray_cl<TA>::DynArray_cl(const DynArray_cl<TA> ©Array) { size = copyArray.size; if (size > 0) { data = (TA*)VBaseAlloc(sizeof(TA)*size); for (unsigned int i = 0; i < copyArray.size; i++) data[i] = copyArray.data[i]; } else { data = NULL; } }
void* operator new(size_t iSize) { return VBaseAlloc(iSize); }
inline void* VISION_CDECL operator new[](size_t iSize, const std::nothrow_t&) throw() try { return VBaseAlloc(iSize); } catch(std::bad_alloc) { return NULL; }
inline void* VISION_CDECL operator new[](size_t iSize) throw (std::bad_alloc) { return VBaseAlloc(iSize); }