Dynalib Utils
DynaAlloc.h
Go to the documentation of this file.
1 //
2 // Created by Ken Kopelson on 18/10/17.
3 //
4 
5 #ifndef DYNAALLOC_H
6 #define DYNAALLOC_H
7 
8 #include <exception>
9 #include <type_traits>
10 #include <cstring>
11 #include "TypeDefs.h"
12 
13 template <class T> class DynaAllocArray {
14  static uint ALLOC_UNITS;
15 
16 public:
17  static T* newArray(uint count);
18  static T* reallocArray(T* array, uint oldCount, uint newCount);
19  static T* deleteArray(T* array);
20  static T* clearArray(T* array, uint count);
21 
22  static void setAllocUnits(uint allocUnits) { ALLOC_UNITS = allocUnits; }
23  static uint getAllocUnits() { return ALLOC_UNITS; }
24 };
25 
26 template <class T> class DynaAllocVect {
27  static uint ALLOC_UNITS;
28 public:
29  static T** newVect(uint count);
30  static T** reallocVect(T** array, uint oldCount, uint newCount, bool isOwner);
31  static T** deleteVect(T** array, uint arrayCount, bool isOwner);
32 
33  static void setAllocUnits(uint allocUnits) { ALLOC_UNITS = allocUnits; }
34  static uint getAllocUnits() { return ALLOC_UNITS; }
35 };
36 
37 
38 #endif //DYNAALLOC_H
Definition: DynaAlloc.h:13
static uint getAllocUnits()
Definition: DynaAlloc.h:34
static T * newArray(uint count)
Definition: DynaAllocImpl.h:15
static uint getAllocUnits()
Definition: DynaAlloc.h:23
static void setAllocUnits(uint allocUnits)
Definition: DynaAlloc.h:33
static T * reallocArray(T *array, uint oldCount, uint newCount)
Definition: DynaAllocImpl.h:19
static T * deleteArray(T *array)
Definition: DynaAllocImpl.h:46
static void setAllocUnits(uint allocUnits)
Definition: DynaAlloc.h:22
static T * clearArray(T *array, uint count)
Definition: DynaAllocImpl.h:52
Definition: DynaAlloc.h:26