1 #ifndef SPACE_TEMPLATES_H
2 #define SPACE_TEMPLATES_H
4 #include "../interface/environment.h"
7 template <
class T>
void get_pt2d(T ** & pt2d,
const delphi_integer& length,
const delphi_integer& width)
12 pt2d=
new T *[length];
13 for (i=0; i<length; i++)
15 pt2d[i] =
new T [width]();
23 template <
class T>
void get_pt3d(T *** & pt3d,
const delphi_integer& length,
const delphi_integer& width,
const delphi_integer& hight)
29 pt3d=
new T **[length];
30 for (i=0; i<length; i++)
32 pt3d[i] =
new T* [width];
33 for (j=0; j<width; j++)
35 pt3d[i][j]=
new T[hight]();
43 template <
class T>
void get_pt4d(T **** & pt4d,
const delphi_integer& length,
const delphi_integer& width,
const delphi_integer& hight,
const delphi_integer& page)
49 pt4d=
new T ***[length];
50 for (i=0; i<length; i++)
52 pt4d[i] =
new T** [width];
53 for (j=0; j<width; j++)
55 pt4d[i][j]=
new T* [hight];
56 for(k=0; k<hight; k++){
57 pt4d[i][j][k]=
new T [page]();
67 template <
class T>
void free_pt2d(T ** & pt2d,
const delphi_integer& length,
const delphi_integer& width)
72 pt2d=
new T *[length];
73 for (i=0; i<length; i++)
82 template <
class T>
void free_pt3d(T *** & pt3d,
const delphi_integer& length,
const delphi_integer& width,
const delphi_integer& hight)
89 for (i=0; i<length; i++)
92 for (j=0; j<width; j++)
106 template <
class T>
void free_pt4d(T **** & pt4d,
const delphi_integer& length,
const delphi_integer& width,
const delphi_integer& hight,
const delphi_integer& page)
109 delphi_integer i,j,k;
113 for (i=0; i<length; i++)
116 for (j=0; j<width; j++)
119 for(k=0; k<hight; k++){
121 delete [] pt4d[i][j][k];
123 delete [] pt4d[i][j];
194 #endif // SPACE_TEMPLATES_H