Go to the documentation of this file.00001
00002 #ifndef vsl_complex_io_txx_
00003 #define vsl_complex_io_txx_
00004
00005
00006
00007
00008
00009
00010
00011 #include "vsl_complex_io.h"
00012 #include <vsl/vsl_binary_io.h>
00013
00014
00015
00016
00017 template <class T>
00018 void vsl_b_write(vsl_b_ostream& s, const vcl_complex<T>& v)
00019 {
00020
00021
00022 vsl_b_write(s, vcl_real(v));
00023 vsl_b_write(s, vcl_imag(v));
00024 }
00025
00026
00027
00028 template <class T>
00029 void vsl_b_read(vsl_b_istream& s, vcl_complex<T>& v)
00030 {
00031 T real_part, imag_part;
00032 vsl_b_read(s, real_part);
00033 vsl_b_read(s, imag_part);
00034 v = vcl_complex<T>(real_part, imag_part);
00035 }
00036
00037
00038
00039 template <class T>
00040 void vsl_print_summary(vcl_ostream& os, const vcl_complex<T> &v)
00041 {
00042 os << vcl_real(v) << " + " << vcl_imag(v) << "i ";
00043 }
00044
00045 #define VSL_COMPLEX_IO_INSTANTIATE(T) \
00046 template void vsl_print_summary(vcl_ostream&, const vcl_complex<T >&); \
00047 template void vsl_b_write(vsl_b_ostream& s, const vcl_complex<T >& v); \
00048 template void vsl_b_read(vsl_b_istream& s, vcl_complex<T >& v)
00049
00050 #endif // vsl_complex_io_txx_