Exemple #1
0
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);
  }    
}
Exemple #2
0
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);
}
Exemple #3
0
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;
}
Exemple #4
0
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);
}
Exemple #5
0
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;
}
Exemple #6
0
template<class TA> DynArray_cl<TA>::DynArray_cl(const DynArray_cl<TA> &copyArray)
{
  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;
  }
}
Exemple #7
0
 void* operator new(size_t iSize)
 {
   return VBaseAlloc(iSize);
 }
Exemple #8
0
 inline void* VISION_CDECL operator new[](size_t iSize, const std::nothrow_t&) throw() try { return VBaseAlloc(iSize); } catch(std::bad_alloc) { return NULL; }
Exemple #9
0
 inline void* VISION_CDECL operator new[](size_t iSize) throw (std::bad_alloc)                 { return VBaseAlloc(iSize); }