class for saving and loading matrices and fields More...
#include <diskio_proto.hpp>
Classes | |
struct | is_supported_type |
Public Member Functions | |
template<typename eT > | |
bool | load_ppm_binary (Cube< eT > &x, const std::string &name, std::string &err_msg) |
template<typename eT > | |
bool | load_ppm_binary (Cube< eT > &x, std::istream &f, std::string &err_msg) |
template<typename eT > | |
bool | save_ppm_binary (const Cube< eT > &x, const std::string &final_name) |
template<typename eT > | |
bool | save_ppm_binary (const Cube< eT > &x, std::ostream &f) |
Static Public Member Functions | |
template<typename eT > | |
static std::string | gen_txt_header (const Mat< eT > &x) |
Generate the first line of the header used for saving matrices in text format. Format: "ARMA_MAT_TXT_ABXYZ". A is one of: I (for integral types) or F (for floating point types). B is one of: U (for unsigned types), S (for signed types), N (for not appliable) or C (for complex types). XYZ specifies the width of each element in terms of bytes, e.g. "008" indicates eight bytes. | |
template<typename eT > | |
static std::string | gen_bin_header (const Mat< eT > &x) |
Generate the first line of the header used for saving matrices in binary format. Format: "ARMA_MAT_BIN_ABXYZ". A is one of: I (for integral types) or F (for floating point types). B is one of: U (for unsigned types), S (for signed types), N (for not appliable) or C (for complex types). XYZ specifies the width of each element in terms of bytes, e.g. "008" indicates eight bytes. | |
template<typename eT > | |
static std::string | gen_txt_header (const Cube< eT > &x) |
Generate the first line of the header used for saving cubes in text format. Format: "ARMA_CUB_TXT_ABXYZ". A is one of: I (for integral types) or F (for floating point types). B is one of: U (for unsigned types), S (for signed types), N (for not appliable) or C (for complex types). XYZ specifies the width of each element in terms of bytes, e.g. "008" indicates eight bytes. | |
template<typename eT > | |
static std::string | gen_bin_header (const Cube< eT > &x) |
Generate the first line of the header used for saving cubes in binary format. Format: "ARMA_CUB_BIN_ABXYZ". A is one of: I (for integral types) or F (for floating point types). B is one of: U (for unsigned types), S (for signed types), N (for not appliable) or C (for complex types). XYZ specifies the width of each element in terms of bytes, e.g. "008" indicates eight bytes. | |
static char | conv_to_hex_char (const u8 x) |
static void | conv_to_hex (char *out, const u8 x) |
static std::string | gen_tmp_name (const std::string &x) |
Append a quasi-random string to the given filename. The rand() function is deliberately not used, as rand() has an internal state that changes from call to call. Such states should not be modified in scientific applications, where the results should be reproducable and not affected by saving data. | |
static bool | safe_rename (const std::string &old_name, const std::string &new_name) |
Safely rename a file. Before renaming, test if we can write to the final file. This should prevent: (i) overwriting files that have been write protected, (ii) overwriting directories. | |
template<typename eT > | |
static bool | save_raw_ascii (const Mat< eT > &x, const std::string &final_name) |
Save a matrix as raw text (no header, human readable). Matrices can be loaded in Matlab and Octave, as long as they don't have complex elements. | |
template<typename eT > | |
static bool | save_arma_ascii (const Mat< eT > &x, const std::string &final_name) |
Save a matrix in text format (human readable), with a header that indicates the matrix type as well as its dimensions. | |
template<typename eT > | |
static bool | save_arma_binary (const Mat< eT > &x, const std::string &final_name) |
Save a matrix in binary format, with a header that stores the matrix type as well as its dimensions. | |
template<typename eT > | |
static bool | save_pgm_binary (const Mat< eT > &x, const std::string &final_name) |
Save a matrix as a PGM greyscale image. | |
template<typename T > | |
static bool | save_pgm_binary (const Mat< std::complex< T > > &x, const std::string &final_name) |
Save a matrix as a PGM greyscale image. | |
template<typename eT > | |
static bool | save_raw_ascii (const Mat< eT > &x, std::ostream &f) |
Save a matrix as raw text (no header, human readable). Matrices can be loaded in Matlab and Octave, as long as they don't have complex elements. | |
template<typename eT > | |
static bool | save_arma_ascii (const Mat< eT > &x, std::ostream &f) |
Save a matrix in text format (human readable), with a header that indicates the matrix type as well as its dimensions. | |
template<typename eT > | |
static bool | save_arma_binary (const Mat< eT > &x, std::ostream &f) |
Save a matrix in binary format, with a header that stores the matrix type as well as its dimensions. | |
template<typename eT > | |
static bool | save_pgm_binary (const Mat< eT > &x, std::ostream &f) |
Save a matrix as a PGM greyscale image. | |
template<typename T > | |
static bool | save_pgm_binary (const Mat< std::complex< T > > &x, std::ostream &f) |
Save a matrix as a PGM greyscale image. | |
template<typename eT > | |
static bool | load_raw_ascii (Mat< eT > &x, const std::string &name, std::string &err_msg) |
Load a matrix as raw text (no header, human readable). Can read matrices saved as text in Matlab and Octave. NOTE: this is much slower than reading a file with a header. | |
template<typename eT > | |
static bool | load_arma_ascii (Mat< eT > &x, const std::string &name, std::string &err_msg) |
Load a matrix in text format (human readable), with a header that indicates the matrix type as well as its dimensions. | |
template<typename eT > | |
static bool | load_arma_binary (Mat< eT > &x, const std::string &name, std::string &err_msg) |
Load a matrix in binary format, with a header that indicates the matrix type as well as its dimensions. | |
template<typename eT > | |
static bool | load_pgm_binary (Mat< eT > &x, const std::string &name, std::string &err_msg) |
Load a PGM greyscale image as a matrix. | |
template<typename T > | |
static bool | load_pgm_binary (Mat< std::complex< T > > &x, const std::string &name, std::string &err_msg) |
Load a PGM greyscale image as a matrix. | |
template<typename eT > | |
static bool | load_auto_detect (Mat< eT > &x, const std::string &name, std::string &err_msg) |
Try to load a matrix by automatically determining its type. | |
template<typename eT > | |
static bool | load_raw_ascii (Mat< eT > &x, std::istream &f, std::string &err_msg) |
Load a matrix as raw text (no header, human readable). Can read matrices saved as text in Matlab and Octave. NOTE: this is much slower than reading a file with a header. | |
template<typename eT > | |
static bool | load_arma_ascii (Mat< eT > &x, std::istream &f, std::string &err_msg) |
Load a matrix in text format (human readable), with a header that indicates the matrix type as well as its dimensions. | |
template<typename eT > | |
static bool | load_arma_binary (Mat< eT > &x, std::istream &f, std::string &err_msg) |
template<typename eT > | |
static bool | load_pgm_binary (Mat< eT > &x, std::istream &is, std::string &err_msg) |
Load a PGM greyscale image as a matrix. | |
template<typename T > | |
static bool | load_pgm_binary (Mat< std::complex< T > > &x, std::istream &is, std::string &err_msg) |
Load a PGM greyscale image as a matrix. | |
template<typename eT > | |
static bool | load_auto_detect (Mat< eT > &x, std::istream &f, std::string &err_msg) |
Try to load a matrix by automatically determining its type. | |
static void | pnm_skip_comments (std::istream &f) |
template<typename eT > | |
static bool | save_raw_ascii (const Cube< eT > &x, const std::string &name) |
Save a cube as raw text (no header, human readable). | |
template<typename eT > | |
static bool | save_arma_ascii (const Cube< eT > &x, const std::string &name) |
Save a cube in text format (human readable), with a header that indicates the cube type as well as its dimensions. | |
template<typename eT > | |
static bool | save_arma_binary (const Cube< eT > &x, const std::string &name) |
Save a cube in binary format, with a header that stores the cube type as well as its dimensions. | |
template<typename eT > | |
static bool | save_raw_ascii (const Cube< eT > &x, std::ostream &f) |
Save a cube as raw text (no header, human readable). | |
template<typename eT > | |
static bool | save_arma_ascii (const Cube< eT > &x, std::ostream &f) |
Save a cube in text format (human readable), with a header that indicates the cube type as well as its dimensions. | |
template<typename eT > | |
static bool | save_arma_binary (const Cube< eT > &x, std::ostream &f) |
Save a cube in binary format, with a header that stores the cube type as well as its dimensions. | |
template<typename eT > | |
static bool | load_raw_ascii (Cube< eT > &x, const std::string &name, std::string &err_msg) |
Load a cube as raw text (no header, human readable). NOTE: this is much slower than reading a file with a header. | |
template<typename eT > | |
static bool | load_arma_ascii (Cube< eT > &x, const std::string &name, std::string &err_msg) |
Load a cube in text format (human readable), with a header that indicates the cube type as well as its dimensions. | |
template<typename eT > | |
static bool | load_arma_binary (Cube< eT > &x, const std::string &name, std::string &err_msg) |
Load a cube in binary format, with a header that indicates the cube type as well as its dimensions. | |
template<typename eT > | |
static bool | load_auto_detect (Cube< eT > &x, const std::string &name, std::string &err_msg) |
Try to load a cube by automatically determining its type. | |
template<typename eT > | |
static bool | load_raw_ascii (Cube< eT > &x, std::istream &f, std::string &err_msg) |
Load a cube as raw text (no header, human readable). NOTE: this is much slower than reading a file with a header. | |
template<typename eT > | |
static bool | load_arma_ascii (Cube< eT > &x, std::istream &f, std::string &err_msg) |
Load a cube in text format (human readable), with a header that indicates the cube type as well as its dimensions. | |
template<typename eT > | |
static bool | load_arma_binary (Cube< eT > &x, std::istream &f, std::string &err_msg) |
template<typename eT > | |
static bool | load_auto_detect (Cube< eT > &x, std::istream &f, std::string &err_msg) |
Try to load a cube by automatically determining its type. | |
template<typename T1 > | |
static bool | save_arma_binary (const field< T1 > &x, const std::string &name) |
template<typename T1 > | |
static bool | save_arma_binary (const field< T1 > &x, std::ostream &f) |
template<typename T1 > | |
static bool | load_arma_binary (field< T1 > &x, const std::string &name, std::string &err_msg) |
template<typename T1 > | |
static bool | load_arma_binary (field< T1 > &x, std::istream &f, std::string &err_msg) |
template<typename T1 > | |
static bool | load_auto_detect (field< T1 > &x, const std::string &name, std::string &err_msg) |
Try to load a field by automatically determining its type. | |
template<typename T1 > | |
static bool | load_auto_detect (field< T1 > &x, std::istream &f, std::string &err_msg) |
Try to load a field by automatically determining its type. | |
static bool | save_std_string (const field< std::string > &x, const std::string &name) |
static bool | save_std_string (const field< std::string > &x, std::ostream &f) |
static bool | load_std_string (field< std::string > &x, const std::string &name, std::string &err_msg) |
static bool | load_std_string (field< std::string > &x, std::istream &f, std::string &err_msg) |
template<typename T1 > | |
static bool | save_ppm_binary (const Cube< T1 > &x, const std::string &final_name) |
template<typename T1 > | |
static bool | save_ppm_binary (const Cube< T1 > &x, std::ostream &f) |
template<typename T1 > | |
static bool | load_ppm_binary (Cube< T1 > &x, const std::string &final_name, std::string &err_msg) |
template<typename T1 > | |
static bool | load_ppm_binary (Cube< T1 > &x, std::istream &f, std::string &err_msg) |
template<typename T1 > | |
static bool | save_ppm_binary (const field< T1 > &x, const std::string &final_name) |
template<typename T1 > | |
static bool | save_ppm_binary (const field< T1 > &x, std::ostream &f) |
template<typename T1 > | |
static bool | load_ppm_binary (field< T1 > &x, const std::string &final_name, std::string &err_msg) |
template<typename T1 > | |
static bool | load_ppm_binary (field< T1 > &x, std::istream &f, std::string &err_msg) |
class for saving and loading matrices and fields
Definition at line 23 of file diskio_proto.hpp.
static bool diskio::save_ppm_binary | ( | const Cube< T1 > & | x, | |
const std::string & | final_name | |||
) | [inline, static] |
Referenced by field_aux::save(), Cube< eT >::save(), and save_ppm_binary().
static bool diskio::save_ppm_binary | ( | const Cube< T1 > & | x, | |
std::ostream & | f | |||
) | [inline, static] |
static bool diskio::load_ppm_binary | ( | Cube< T1 > & | x, | |
const std::string & | final_name, | |||
std::string & | err_msg | |||
) | [inline, static] |
Referenced by field_aux::load(), Cube< eT >::load(), load_auto_detect(), and load_ppm_binary().
static bool diskio::load_ppm_binary | ( | Cube< T1 > & | x, | |
std::istream & | f, | |||
std::string & | err_msg | |||
) | [inline, static] |