diskio_bones.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
00002 // Copyright (C) 2008-2011 Conrad Sanderson
00003 // Copyright (C) 2009-2010 Ian Cullinan
00004 // 
00005 // This file is part of the Armadillo C++ library.
00006 // It is provided without any warranty of fitness
00007 // for any purpose. You can redistribute this file
00008 // and/or modify it under the terms of the GNU
00009 // Lesser General Public License (LGPL) as published
00010 // by the Free Software Foundation, either version 3
00011 // of the License or (at your option) any later version.
00012 // (see http://www.opensource.org/licenses for more info)
00013 
00014 
00017 
00018 
00020 class diskio
00021   {
00022   public:
00023   
00024   template<typename eT> inline static std::string gen_txt_header(const Mat<eT>& x);
00025   template<typename eT> inline static std::string gen_bin_header(const Mat<eT>& x);
00026   
00027   template<typename eT> inline static std::string gen_txt_header(const Cube<eT>& x);
00028   template<typename eT> inline static std::string gen_bin_header(const Cube<eT>& x);
00029   
00030   inline static file_type guess_file_type(std::istream& f);
00031   
00032   inline static char conv_to_hex_char(const u8 x);
00033   inline static void conv_to_hex(char* out, const u8 x);
00034   
00035   inline static std::string gen_tmp_name(const std::string& x);
00036   
00037   inline static bool safe_rename(const std::string& old_name, const std::string& new_name);
00038   
00039   
00040   //
00041   // matrix saving
00042   
00043   template<typename eT> inline static bool save_raw_ascii  (const Mat<eT>&                x, const std::string& final_name);
00044   template<typename eT> inline static bool save_raw_binary (const Mat<eT>&                x, const std::string& final_name);
00045   template<typename eT> inline static bool save_arma_ascii (const Mat<eT>&                x, const std::string& final_name);
00046   template<typename eT> inline static bool save_csv_ascii  (const Mat<eT>&                x, const std::string& final_name);
00047   template<typename eT> inline static bool save_arma_binary(const Mat<eT>&                x, const std::string& final_name);
00048   template<typename eT> inline static bool save_pgm_binary (const Mat<eT>&                x, const std::string& final_name);
00049   template<typename  T> inline static bool save_pgm_binary (const Mat< std::complex<T> >& x, const std::string& final_name);
00050   
00051   template<typename eT> inline static bool save_raw_ascii  (const Mat<eT>&                x, std::ostream& f);
00052   template<typename eT> inline static bool save_raw_binary (const Mat<eT>&                x, std::ostream& f);
00053   template<typename eT> inline static bool save_arma_ascii (const Mat<eT>&                x, std::ostream& f);
00054   template<typename eT> inline static bool save_csv_ascii  (const Mat<eT>&                x, std::ostream& f);
00055   template<typename eT> inline static bool save_arma_binary(const Mat<eT>&                x, std::ostream& f);
00056   template<typename eT> inline static bool save_pgm_binary (const Mat<eT>&                x, std::ostream& f);
00057   template<typename  T> inline static bool save_pgm_binary (const Mat< std::complex<T> >& x, std::ostream& f);
00058   
00059   
00060   //
00061   // matrix loading
00062   
00063   template<typename eT> inline static bool load_raw_ascii  (Mat<eT>&                x, const std::string& name, std::string& err_msg);
00064   template<typename eT> inline static bool load_raw_binary (Mat<eT>&                x, const std::string& name, std::string& err_msg);
00065   template<typename eT> inline static bool load_arma_ascii (Mat<eT>&                x, const std::string& name, std::string& err_msg);
00066   template<typename eT> inline static bool load_csv_ascii  (Mat<eT>&                x, const std::string& name, std::string& err_msg);
00067   template<typename eT> inline static bool load_arma_binary(Mat<eT>&                x, const std::string& name, std::string& err_msg);
00068   template<typename eT> inline static bool load_pgm_binary (Mat<eT>&                x, const std::string& name, std::string& err_msg);
00069   template<typename  T> inline static bool load_pgm_binary (Mat< std::complex<T> >& x, const std::string& name, std::string& err_msg);
00070   template<typename eT> inline static bool load_auto_detect(Mat<eT>&                x, const std::string& name, std::string& err_msg);
00071   
00072   template<typename eT> inline static bool load_raw_ascii  (Mat<eT>&                x, std::istream& f,  std::string& err_msg);
00073   template<typename eT> inline static bool load_raw_binary (Mat<eT>&                x, std::istream& f,  std::string& err_msg);
00074   template<typename eT> inline static bool load_arma_ascii (Mat<eT>&                x, std::istream& f,  std::string& err_msg);
00075   template<typename eT> inline static bool load_csv_ascii  (Mat<eT>&                x, std::istream& f,  std::string& err_msg);
00076   template<typename eT> inline static bool load_arma_binary(Mat<eT>&                x, std::istream& f,  std::string& err_msg);
00077   template<typename eT> inline static bool load_pgm_binary (Mat<eT>&                x, std::istream& is, std::string& err_msg);
00078   template<typename  T> inline static bool load_pgm_binary (Mat< std::complex<T> >& x, std::istream& is, std::string& err_msg);
00079   template<typename eT> inline static bool load_auto_detect(Mat<eT>&                x, std::istream& f,  std::string& err_msg);
00080   
00081   inline static void pnm_skip_comments(std::istream& f);
00082   
00083   
00084   //
00085   // cube saving
00086   
00087   template<typename eT> inline static bool save_raw_ascii  (const Cube<eT>& x, const std::string& name);
00088   template<typename eT> inline static bool save_raw_binary (const Cube<eT>& x, const std::string& name);
00089   template<typename eT> inline static bool save_arma_ascii (const Cube<eT>& x, const std::string& name);
00090   template<typename eT> inline static bool save_arma_binary(const Cube<eT>& x, const std::string& name);
00091   
00092   template<typename eT> inline static bool save_raw_ascii  (const Cube<eT>& x, std::ostream& f);
00093   template<typename eT> inline static bool save_raw_binary (const Cube<eT>& x, std::ostream& f);
00094   template<typename eT> inline static bool save_arma_ascii (const Cube<eT>& x, std::ostream& f);
00095   template<typename eT> inline static bool save_arma_binary(const Cube<eT>& x, std::ostream& f);
00096   
00097   
00098   //
00099   // cube loading
00100   
00101   template<typename eT> inline static bool load_raw_ascii  (Cube<eT>& x, const std::string& name, std::string& err_msg);
00102   template<typename eT> inline static bool load_raw_binary (Cube<eT>& x, const std::string& name, std::string& err_msg);
00103   template<typename eT> inline static bool load_arma_ascii (Cube<eT>& x, const std::string& name, std::string& err_msg);
00104   template<typename eT> inline static bool load_arma_binary(Cube<eT>& x, const std::string& name, std::string& err_msg);
00105   template<typename eT> inline static bool load_auto_detect(Cube<eT>& x, const std::string& name, std::string& err_msg);
00106   
00107   template<typename eT> inline static bool load_raw_ascii  (Cube<eT>& x, std::istream& f, std::string& err_msg);
00108   template<typename eT> inline static bool load_raw_binary (Cube<eT>& x, std::istream& f, std::string& err_msg);
00109   template<typename eT> inline static bool load_arma_ascii (Cube<eT>& x, std::istream& f, std::string& err_msg);
00110   template<typename eT> inline static bool load_arma_binary(Cube<eT>& x, std::istream& f, std::string& err_msg);
00111   template<typename eT> inline static bool load_auto_detect(Cube<eT>& x, std::istream& f, std::string& err_msg);
00112   
00113   
00114   //
00115   // field saving and loading
00116   
00117   template<typename T1> inline static bool save_arma_binary(const field<T1>& x, const std::string&  name);
00118   template<typename T1> inline static bool save_arma_binary(const field<T1>& x,       std::ostream& f);
00119   
00120   template<typename T1> inline static bool load_arma_binary(      field<T1>& x, const std::string&  name, std::string& err_msg);
00121   template<typename T1> inline static bool load_arma_binary(      field<T1>& x,       std::istream& f,    std::string& err_msg);
00122   
00123   template<typename T1> inline static bool load_auto_detect(      field<T1>& x, const std::string&  name, std::string& err_msg);
00124   template<typename T1> inline static bool load_auto_detect(      field<T1>& x,       std::istream& f,    std::string& err_msg);
00125   
00126   inline static bool save_std_string(const field<std::string>& x, const std::string&  name);
00127   inline static bool save_std_string(const field<std::string>& x,       std::ostream& f);
00128   
00129   inline static bool load_std_string(      field<std::string>& x, const std::string&  name, std::string& err_msg);
00130   inline static bool load_std_string(      field<std::string>& x,       std::istream& f,    std::string& err_msg);
00131   
00132 
00133 
00134   //
00135   // handling of PPM images by cubes
00136 
00137   template<typename T1> inline static bool save_ppm_binary(const Cube<T1>& x, const std::string&  final_name);
00138   template<typename T1> inline static bool save_ppm_binary(const Cube<T1>& x,       std::ostream& f);
00139   
00140   template<typename T1> inline static bool load_ppm_binary(      Cube<T1>& x, const std::string&  final_name, std::string& err_msg);
00141   template<typename T1> inline static bool load_ppm_binary(      Cube<T1>& x,       std::istream& f,          std::string& err_msg);
00142 
00143 
00144   //
00145   // handling of PPM images by fields
00146 
00147   template<typename T1> inline static bool save_ppm_binary(const field<T1>& x, const std::string&  final_name);
00148   template<typename T1> inline static bool save_ppm_binary(const field<T1>& x,       std::ostream& f);
00149   
00150   template<typename T1> inline static bool load_ppm_binary(      field<T1>& x, const std::string&  final_name, std::string& err_msg);
00151   template<typename T1> inline static bool load_ppm_binary(      field<T1>& x,       std::istream& f,          std::string& err_msg);
00152   
00153 
00154 
00155   };
00156 
00157 
00158 


armadillo_matrix
Author(s): Conrad Sanderson - NICTA (www.nicta.com.au), (Wrapper by Sjoerd van den Dries)
autogenerated on Tue Jan 7 2014 11:42:03