#ifndef GENERS_COMPLEXIO_HH_ #define GENERS_COMPLEXIO_HH_ #include #include "geners/binaryIO.hh" #include "geners/IOIsPOD.hh" #include "geners/IOIsContainer.hh" #define gs_specialize_complex_read_write(T) /**/ \ namespace gs { \ template <> \ inline void write_pod >(std::ostream& of, \ const std::complex& s) \ { \ write_pod(of, s.real()); \ write_pod(of, s.imag()); \ } \ template <> \ inline void read_pod >(std::istream& in, \ std::complex* ps) \ { \ assert(ps); \ T re, im; \ read_pod(in, &re); \ read_pod(in, &im); \ *ps = std::complex(re, im); \ } \ template <> \ inline void write_pod_array >( \ std::ostream& of, const std::complex* pod, \ const unsigned long len) \ { \ if (len) \ { \ assert(pod); \ for (unsigned long i=0; i >(of, pod[i]); \ } \ } \ template <> \ inline void read_pod_array >( \ std::istream& in, std::complex* pod, \ const unsigned long len) \ { \ if (len) \ { \ assert(pod); \ T re, im; \ for (unsigned long i=0; i(re, im); \ } \ } \ } \ } gs_specialize_complex_read_write(float) gs_specialize_complex_read_write(double) gs_specialize_complex_read_write(long double) namespace gs { template struct IOIsPOD > { enum {value = 1}; }; template struct IOIsPOD > { enum {value = 1}; }; template struct IOIsPOD > { enum {value = 1}; }; template struct IOIsPOD > { enum {value = 1}; }; template class IOIsContainer > { public: enum {value = 0}; }; template class IOIsContainer > { public: enum {value = 0}; }; template class IOIsContainer > { public: enum {value = 0}; }; template class IOIsContainer > { public: enum {value = 0}; }; } gs_specialize_template_id_T(std::complex, 0, 1) #endif // GENERS_COMPLEXIO_HH_