#ifndef CasterComplexInt_h #define CasterComplexInt_h #ifndef MESSAGE #define MESSAGE cout << "file " << __FILE__ << " line " << __LINE__ << endl; #endif #ifndef ERR_MESSAGE #define ERR_MESSAGE cout << "Error in file " << __FILE__ << " at line " << __LINE__ << " Exiting" << endl; exit(1); #endif #include #include "DataCasterT.h" #include #include using namespace std; template class CasterComplexInt: public DataCasterT { public: CasterComplexInt() { this->DataSizeIn = sizeof(complex); this->DataSizeOut = sizeof(complex); } virtual ~CasterComplexInt() {} void convert(char * in, char * out, int numEl) { for (int i = 0, j = 0, k = 0; i < numEl; ++i, j += this->DataSizeIn, k += this->DataSizeOut) { complex * tmp = (complex *) &in[j]; (*(complex *) &out[k]) = complex ( real((*tmp)),imag((*tmp))); } } }; #endif //CasterComplexInt_h