00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 class diskio
00024 {
00025 public:
00026
00027 template<typename eT>
00028 struct is_supported_type
00029 {
00030 static const bool value =
00031 (
00032 false
00033 || is_u8<eT>::value
00034 || is_s8<eT>::value
00035 || is_u16<eT>::value
00036 || is_s16<eT>::value
00037 || is_u32<eT>::value
00038 || is_s32<eT>::value
00039 || is_float<eT>::value
00040 || is_double<eT>::value
00041 || is_complex_float<eT>::value
00042 || is_complex_double<eT>::value
00043 );
00044 };
00045
00046
00047 template<typename eT> inline static std::string gen_txt_header(const Mat<eT>& x);
00048 template<typename eT> inline static std::string gen_bin_header(const Mat<eT>& x);
00049
00050 template<typename eT> inline static std::string gen_txt_header(const Cube<eT>& x);
00051 template<typename eT> inline static std::string gen_bin_header(const Cube<eT>& x);
00052
00053
00054 inline static char conv_to_hex_char(const u8 x);
00055 inline static void conv_to_hex(char* out, const u8 x);
00056
00057 inline static std::string gen_tmp_name(const std::string& x);
00058
00059 inline static bool safe_rename(const std::string& old_name, const std::string& new_name);
00060
00061
00062
00063
00064
00065 template<typename eT> inline static bool save_raw_ascii (const Mat<eT>& x, const std::string& final_name);
00066 template<typename eT> inline static bool save_arma_ascii (const Mat<eT>& x, const std::string& final_name);
00067 template<typename eT> inline static bool save_arma_binary(const Mat<eT>& x, const std::string& final_name);
00068 template<typename eT> inline static bool save_pgm_binary (const Mat<eT>& x, const std::string& final_name);
00069 template<typename T> inline static bool save_pgm_binary (const Mat< std::complex<T> >& x, const std::string& final_name);
00070
00071 template<typename eT> inline static bool save_raw_ascii (const Mat<eT>& x, std::ostream& f);
00072 template<typename eT> inline static bool save_arma_ascii (const Mat<eT>& x, std::ostream& f);
00073 template<typename eT> inline static bool save_arma_binary(const Mat<eT>& x, std::ostream& f);
00074 template<typename eT> inline static bool save_pgm_binary (const Mat<eT>& x, std::ostream& f);
00075 template<typename T> inline static bool save_pgm_binary (const Mat< std::complex<T> >& x, std::ostream& f);
00076
00077
00078
00079
00080
00081 template<typename eT> inline static bool load_raw_ascii (Mat<eT>& x, const std::string& name, std::string& err_msg);
00082 template<typename eT> inline static bool load_arma_ascii (Mat<eT>& x, const std::string& name, std::string& err_msg);
00083 template<typename eT> inline static bool load_arma_binary(Mat<eT>& x, const std::string& name, std::string& err_msg);
00084 template<typename eT> inline static bool load_pgm_binary (Mat<eT>& x, const std::string& name, std::string& err_msg);
00085 template<typename T> inline static bool load_pgm_binary (Mat< std::complex<T> >& x, const std::string& name, std::string& err_msg);
00086 template<typename eT> inline static bool load_auto_detect(Mat<eT>& x, const std::string& name, std::string& err_msg);
00087
00088 template<typename eT> inline static bool load_raw_ascii (Mat<eT>& x, std::istream& f, std::string& err_msg);
00089 template<typename eT> inline static bool load_arma_ascii (Mat<eT>& x, std::istream& f, std::string& err_msg);
00090 template<typename eT> inline static bool load_arma_binary(Mat<eT>& x, std::istream& f, std::string& err_msg);
00091 template<typename eT> inline static bool load_pgm_binary (Mat<eT>& x, std::istream& is, std::string& err_msg);
00092 template<typename T> inline static bool load_pgm_binary (Mat< std::complex<T> >& x, std::istream& is, std::string& err_msg);
00093 template<typename eT> inline static bool load_auto_detect(Mat<eT>& x, std::istream& f, std::string& err_msg);
00094
00095 inline static void pnm_skip_comments(std::istream& f);
00096
00097
00098
00099
00100
00101 template<typename eT> inline static bool save_raw_ascii (const Cube<eT>& x, const std::string& name);
00102 template<typename eT> inline static bool save_arma_ascii (const Cube<eT>& x, const std::string& name);
00103 template<typename eT> inline static bool save_arma_binary(const Cube<eT>& x, const std::string& name);
00104
00105 template<typename eT> inline static bool save_raw_ascii (const Cube<eT>& x, std::ostream& f);
00106 template<typename eT> inline static bool save_arma_ascii (const Cube<eT>& x, std::ostream& f);
00107 template<typename eT> inline static bool save_arma_binary(const Cube<eT>& x, std::ostream& f);
00108
00109
00110
00111
00112
00113 template<typename eT> inline static bool load_raw_ascii (Cube<eT>& x, const std::string& name, std::string& err_msg);
00114 template<typename eT> inline static bool load_arma_ascii (Cube<eT>& x, const std::string& name, std::string& err_msg);
00115 template<typename eT> inline static bool load_arma_binary(Cube<eT>& x, const std::string& name, std::string& err_msg);
00116 template<typename eT> inline static bool load_auto_detect(Cube<eT>& x, const std::string& name, std::string& err_msg);
00117
00118 template<typename eT> inline static bool load_raw_ascii (Cube<eT>& x, std::istream& f, std::string& err_msg);
00119 template<typename eT> inline static bool load_arma_ascii (Cube<eT>& x, std::istream& f, std::string& err_msg);
00120 template<typename eT> inline static bool load_arma_binary(Cube<eT>& x, std::istream& f, std::string& err_msg);
00121 template<typename eT> inline static bool load_auto_detect(Cube<eT>& x, std::istream& f, std::string& err_msg);
00122
00123
00124
00125
00126
00127 template<typename T1> inline static bool save_arma_binary(const field<T1>& x, const std::string& name);
00128 template<typename T1> inline static bool save_arma_binary(const field<T1>& x, std::ostream& f);
00129
00130 template<typename T1> inline static bool load_arma_binary( field<T1>& x, const std::string& name, std::string& err_msg);
00131 template<typename T1> inline static bool load_arma_binary( field<T1>& x, std::istream& f, std::string& err_msg);
00132
00133 template<typename T1> inline static bool load_auto_detect( field<T1>& x, const std::string& name, std::string& err_msg);
00134 template<typename T1> inline static bool load_auto_detect( field<T1>& x, std::istream& f, std::string& err_msg);
00135
00136 inline static bool save_std_string(const field<std::string>& x, const std::string& name);
00137 inline static bool save_std_string(const field<std::string>& x, std::ostream& f);
00138
00139 inline static bool load_std_string( field<std::string>& x, const std::string& name, std::string& err_msg);
00140 inline static bool load_std_string( field<std::string>& x, std::istream& f, std::string& err_msg);
00141
00142
00143
00144
00145
00146
00147 template<typename T1> inline static bool save_ppm_binary(const Cube<T1>& x, const std::string& final_name);
00148 template<typename T1> inline static bool save_ppm_binary(const Cube<T1>& x, std::ostream& f);
00149
00150 template<typename T1> inline static bool load_ppm_binary( Cube<T1>& x, const std::string& final_name, std::string& err_msg);
00151 template<typename T1> inline static bool load_ppm_binary( Cube<T1>& x, std::istream& f, std::string& err_msg);
00152
00153
00154
00155
00156
00157 template<typename T1> inline static bool save_ppm_binary(const field<T1>& x, const std::string& final_name);
00158 template<typename T1> inline static bool save_ppm_binary(const field<T1>& x, std::ostream& f);
00159
00160 template<typename T1> inline static bool load_ppm_binary( field<T1>& x, const std::string& final_name, std::string& err_msg);
00161 template<typename T1> inline static bool load_ppm_binary( field<T1>& x, std::istream& f, std::string& err_msg);
00162
00163
00164
00165 };
00166
00167
00168
00169