max@0
|
1 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
|
max@0
|
2 // Copyright (C) 2008-2011 Conrad Sanderson
|
max@0
|
3 // Copyright (C) 2009-2010 Ian Cullinan
|
max@0
|
4 //
|
max@0
|
5 // This file is part of the Armadillo C++ library.
|
max@0
|
6 // It is provided without any warranty of fitness
|
max@0
|
7 // for any purpose. You can redistribute this file
|
max@0
|
8 // and/or modify it under the terms of the GNU
|
max@0
|
9 // Lesser General Public License (LGPL) as published
|
max@0
|
10 // by the Free Software Foundation, either version 3
|
max@0
|
11 // of the License or (at your option) any later version.
|
max@0
|
12 // (see http://www.opensource.org/licenses for more info)
|
max@0
|
13
|
max@0
|
14
|
max@0
|
15 //! \addtogroup diskio
|
max@0
|
16 //! @{
|
max@0
|
17
|
max@0
|
18
|
max@0
|
19 //! class for saving and loading matrices and fields
|
max@0
|
20 class diskio
|
max@0
|
21 {
|
max@0
|
22 public:
|
max@0
|
23
|
max@0
|
24 template<typename eT> inline static std::string gen_txt_header(const Mat<eT>& x);
|
max@0
|
25 template<typename eT> inline static std::string gen_bin_header(const Mat<eT>& x);
|
max@0
|
26
|
max@0
|
27 template<typename eT> inline static std::string gen_txt_header(const Cube<eT>& x);
|
max@0
|
28 template<typename eT> inline static std::string gen_bin_header(const Cube<eT>& x);
|
max@0
|
29
|
max@0
|
30 inline static file_type guess_file_type(std::istream& f);
|
max@0
|
31
|
max@0
|
32 inline static char conv_to_hex_char(const u8 x);
|
max@0
|
33 inline static void conv_to_hex(char* out, const u8 x);
|
max@0
|
34
|
max@0
|
35 inline static std::string gen_tmp_name(const std::string& x);
|
max@0
|
36
|
max@0
|
37 inline static bool safe_rename(const std::string& old_name, const std::string& new_name);
|
max@0
|
38
|
max@0
|
39
|
max@0
|
40 //
|
max@0
|
41 // matrix saving
|
max@0
|
42
|
max@0
|
43 template<typename eT> inline static bool save_raw_ascii (const Mat<eT>& x, const std::string& final_name);
|
max@0
|
44 template<typename eT> inline static bool save_raw_binary (const Mat<eT>& x, const std::string& final_name);
|
max@0
|
45 template<typename eT> inline static bool save_arma_ascii (const Mat<eT>& x, const std::string& final_name);
|
max@0
|
46 template<typename eT> inline static bool save_csv_ascii (const Mat<eT>& x, const std::string& final_name);
|
max@0
|
47 template<typename eT> inline static bool save_arma_binary(const Mat<eT>& x, const std::string& final_name);
|
max@0
|
48 template<typename eT> inline static bool save_pgm_binary (const Mat<eT>& x, const std::string& final_name);
|
max@0
|
49 template<typename T> inline static bool save_pgm_binary (const Mat< std::complex<T> >& x, const std::string& final_name);
|
max@0
|
50
|
max@0
|
51 template<typename eT> inline static bool save_raw_ascii (const Mat<eT>& x, std::ostream& f);
|
max@0
|
52 template<typename eT> inline static bool save_raw_binary (const Mat<eT>& x, std::ostream& f);
|
max@0
|
53 template<typename eT> inline static bool save_arma_ascii (const Mat<eT>& x, std::ostream& f);
|
max@0
|
54 template<typename eT> inline static bool save_csv_ascii (const Mat<eT>& x, std::ostream& f);
|
max@0
|
55 template<typename eT> inline static bool save_arma_binary(const Mat<eT>& x, std::ostream& f);
|
max@0
|
56 template<typename eT> inline static bool save_pgm_binary (const Mat<eT>& x, std::ostream& f);
|
max@0
|
57 template<typename T> inline static bool save_pgm_binary (const Mat< std::complex<T> >& x, std::ostream& f);
|
max@0
|
58
|
max@0
|
59
|
max@0
|
60 //
|
max@0
|
61 // matrix loading
|
max@0
|
62
|
max@0
|
63 template<typename eT> inline static bool load_raw_ascii (Mat<eT>& x, const std::string& name, std::string& err_msg);
|
max@0
|
64 template<typename eT> inline static bool load_raw_binary (Mat<eT>& x, const std::string& name, std::string& err_msg);
|
max@0
|
65 template<typename eT> inline static bool load_arma_ascii (Mat<eT>& x, const std::string& name, std::string& err_msg);
|
max@0
|
66 template<typename eT> inline static bool load_csv_ascii (Mat<eT>& x, const std::string& name, std::string& err_msg);
|
max@0
|
67 template<typename eT> inline static bool load_arma_binary(Mat<eT>& x, const std::string& name, std::string& err_msg);
|
max@0
|
68 template<typename eT> inline static bool load_pgm_binary (Mat<eT>& x, const std::string& name, std::string& err_msg);
|
max@0
|
69 template<typename T> inline static bool load_pgm_binary (Mat< std::complex<T> >& x, const std::string& name, std::string& err_msg);
|
max@0
|
70 template<typename eT> inline static bool load_auto_detect(Mat<eT>& x, const std::string& name, std::string& err_msg);
|
max@0
|
71
|
max@0
|
72 template<typename eT> inline static bool load_raw_ascii (Mat<eT>& x, std::istream& f, std::string& err_msg);
|
max@0
|
73 template<typename eT> inline static bool load_raw_binary (Mat<eT>& x, std::istream& f, std::string& err_msg);
|
max@0
|
74 template<typename eT> inline static bool load_arma_ascii (Mat<eT>& x, std::istream& f, std::string& err_msg);
|
max@0
|
75 template<typename eT> inline static bool load_csv_ascii (Mat<eT>& x, std::istream& f, std::string& err_msg);
|
max@0
|
76 template<typename eT> inline static bool load_arma_binary(Mat<eT>& x, std::istream& f, std::string& err_msg);
|
max@0
|
77 template<typename eT> inline static bool load_pgm_binary (Mat<eT>& x, std::istream& is, std::string& err_msg);
|
max@0
|
78 template<typename T> inline static bool load_pgm_binary (Mat< std::complex<T> >& x, std::istream& is, std::string& err_msg);
|
max@0
|
79 template<typename eT> inline static bool load_auto_detect(Mat<eT>& x, std::istream& f, std::string& err_msg);
|
max@0
|
80
|
max@0
|
81 inline static void pnm_skip_comments(std::istream& f);
|
max@0
|
82
|
max@0
|
83
|
max@0
|
84 //
|
max@0
|
85 // cube saving
|
max@0
|
86
|
max@0
|
87 template<typename eT> inline static bool save_raw_ascii (const Cube<eT>& x, const std::string& name);
|
max@0
|
88 template<typename eT> inline static bool save_raw_binary (const Cube<eT>& x, const std::string& name);
|
max@0
|
89 template<typename eT> inline static bool save_arma_ascii (const Cube<eT>& x, const std::string& name);
|
max@0
|
90 template<typename eT> inline static bool save_arma_binary(const Cube<eT>& x, const std::string& name);
|
max@0
|
91
|
max@0
|
92 template<typename eT> inline static bool save_raw_ascii (const Cube<eT>& x, std::ostream& f);
|
max@0
|
93 template<typename eT> inline static bool save_raw_binary (const Cube<eT>& x, std::ostream& f);
|
max@0
|
94 template<typename eT> inline static bool save_arma_ascii (const Cube<eT>& x, std::ostream& f);
|
max@0
|
95 template<typename eT> inline static bool save_arma_binary(const Cube<eT>& x, std::ostream& f);
|
max@0
|
96
|
max@0
|
97
|
max@0
|
98 //
|
max@0
|
99 // cube loading
|
max@0
|
100
|
max@0
|
101 template<typename eT> inline static bool load_raw_ascii (Cube<eT>& x, const std::string& name, std::string& err_msg);
|
max@0
|
102 template<typename eT> inline static bool load_raw_binary (Cube<eT>& x, const std::string& name, std::string& err_msg);
|
max@0
|
103 template<typename eT> inline static bool load_arma_ascii (Cube<eT>& x, const std::string& name, std::string& err_msg);
|
max@0
|
104 template<typename eT> inline static bool load_arma_binary(Cube<eT>& x, const std::string& name, std::string& err_msg);
|
max@0
|
105 template<typename eT> inline static bool load_auto_detect(Cube<eT>& x, const std::string& name, std::string& err_msg);
|
max@0
|
106
|
max@0
|
107 template<typename eT> inline static bool load_raw_ascii (Cube<eT>& x, std::istream& f, std::string& err_msg);
|
max@0
|
108 template<typename eT> inline static bool load_raw_binary (Cube<eT>& x, std::istream& f, std::string& err_msg);
|
max@0
|
109 template<typename eT> inline static bool load_arma_ascii (Cube<eT>& x, std::istream& f, std::string& err_msg);
|
max@0
|
110 template<typename eT> inline static bool load_arma_binary(Cube<eT>& x, std::istream& f, std::string& err_msg);
|
max@0
|
111 template<typename eT> inline static bool load_auto_detect(Cube<eT>& x, std::istream& f, std::string& err_msg);
|
max@0
|
112
|
max@0
|
113
|
max@0
|
114 //
|
max@0
|
115 // field saving and loading
|
max@0
|
116
|
max@0
|
117 template<typename T1> inline static bool save_arma_binary(const field<T1>& x, const std::string& name);
|
max@0
|
118 template<typename T1> inline static bool save_arma_binary(const field<T1>& x, std::ostream& f);
|
max@0
|
119
|
max@0
|
120 template<typename T1> inline static bool load_arma_binary( field<T1>& x, const std::string& name, std::string& err_msg);
|
max@0
|
121 template<typename T1> inline static bool load_arma_binary( field<T1>& x, std::istream& f, std::string& err_msg);
|
max@0
|
122
|
max@0
|
123 template<typename T1> inline static bool load_auto_detect( field<T1>& x, const std::string& name, std::string& err_msg);
|
max@0
|
124 template<typename T1> inline static bool load_auto_detect( field<T1>& x, std::istream& f, std::string& err_msg);
|
max@0
|
125
|
max@0
|
126 inline static bool save_std_string(const field<std::string>& x, const std::string& name);
|
max@0
|
127 inline static bool save_std_string(const field<std::string>& x, std::ostream& f);
|
max@0
|
128
|
max@0
|
129 inline static bool load_std_string( field<std::string>& x, const std::string& name, std::string& err_msg);
|
max@0
|
130 inline static bool load_std_string( field<std::string>& x, std::istream& f, std::string& err_msg);
|
max@0
|
131
|
max@0
|
132
|
max@0
|
133
|
max@0
|
134 //
|
max@0
|
135 // handling of PPM images by cubes
|
max@0
|
136
|
max@0
|
137 template<typename T1> inline static bool save_ppm_binary(const Cube<T1>& x, const std::string& final_name);
|
max@0
|
138 template<typename T1> inline static bool save_ppm_binary(const Cube<T1>& x, std::ostream& f);
|
max@0
|
139
|
max@0
|
140 template<typename T1> inline static bool load_ppm_binary( Cube<T1>& x, const std::string& final_name, std::string& err_msg);
|
max@0
|
141 template<typename T1> inline static bool load_ppm_binary( Cube<T1>& x, std::istream& f, std::string& err_msg);
|
max@0
|
142
|
max@0
|
143
|
max@0
|
144 //
|
max@0
|
145 // handling of PPM images by fields
|
max@0
|
146
|
max@0
|
147 template<typename T1> inline static bool save_ppm_binary(const field<T1>& x, const std::string& final_name);
|
max@0
|
148 template<typename T1> inline static bool save_ppm_binary(const field<T1>& x, std::ostream& f);
|
max@0
|
149
|
max@0
|
150 template<typename T1> inline static bool load_ppm_binary( field<T1>& x, const std::string& final_name, std::string& err_msg);
|
max@0
|
151 template<typename T1> inline static bool load_ppm_binary( field<T1>& x, std::istream& f, std::string& err_msg);
|
max@0
|
152
|
max@0
|
153
|
max@0
|
154
|
max@0
|
155 };
|
max@0
|
156
|
max@0
|
157
|
max@0
|
158
|
max@0
|
159 //! @}
|