forked from SvenDeSmet/ESTL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataInterface.h
47 lines (37 loc) · 1.63 KB
/
DataInterface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef DATAINTERFACE_H
#define DATAINTERFACE_H
#include <Complex.h>
template <class D> class DataInterface {
public:
virtual inline void setElement(int index, Complex<D> value, int batchIndex = 0) = 0;
virtual inline Complex<D> getElement(int index, int batchIndex = 0) = 0;
virtual ~DataInterface() { }
};
template <class D, class A> class ArrayDataInterface : public DataInterface<D> {
protected:
int size;
public:
A *in, *out;
ArrayDataInterface(int iSize) : size(iSize) { }
virtual ~ArrayDataInterface() { delete in; delete out; }
inline void setElement(int index, Complex<D> value, int batchIndex = 0) { this->in->setElement(batchIndex*size + index, value); }
inline Complex<D> getElement(int index, int batchIndex = 0) { return this->out->getElement(batchIndex*size + index); }
};
template <class D> class PlannarizedDataInterface : public ArrayDataInterface<D, PlannarizedComplexArray<GlobalPlannarLevel, D> > {
private:
public:
typedef PlannarizedComplexArray<GlobalPlannarLevel, D> Array;
PlannarizedDataInterface(int iSize) : ArrayDataInterface<D, PlannarizedComplexArray<GlobalPlannarLevel, D> >(iSize) {
this->in = new Array(this->size);
this->out = new Array(this->size);
}
};
template <class D> class SplitInterleavedDataInterface : public ArrayDataInterface<D, ComplexArray<D> > {
public:
typedef ComplexArray<D> Array;
SplitInterleavedDataInterface(int iSize, bool plannar = true) : ArrayDataInterface<D, ComplexArray<D> >(iSize) {
this->in = new Array(this->size, plannar);
this->out = new Array(this->size, plannar);
}
};
#endif // DATAINTERFACE_H