/*GenArray.c */

#include<SYNERGY/GenArray.h>

 GenArray::GenArray()
{
  ptr = nil;
  size = 0;
}

 GenArray::GenArray(size_t size)
{
  ptr = new char[size];
  this->size = size;
}


 GenArray::GenArray(const GenArray &genarray, size_t addsize = 0)
{/* note that genarray passed could be myself, so be careful */
  register newsize = genarray.size + addsize;
  register CPtr temp = new char[newsize];
  
  memcpy(temp, genarray.ptr, genarray.size);
  this->~GenArray();

  ptr = temp;
  size = newsize;
}

 GenArray::~GenArray(void)
{
  delete ptr; size = 0; ptr = nil;
}

