load-save.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1994-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #if !defined (octave_load_save_h)
00024 #define octave_load_save_h 1
00025 
00026 #include <iosfwd>
00027 #include <string>
00028 
00029 class octave_value;
00030 
00031 // FIXME: maybe MAT5 and MAT7 should be options to MAT_BINARY.
00032 // Similarly, save_as_floats may be an option for LS_BINARY, LS_HDF5 etc.
00033 enum load_save_format_type
00034   {
00035     LS_ASCII,
00036     LS_BINARY,
00037     LS_MAT_ASCII,
00038     LS_MAT_BINARY,
00039     LS_MAT5_BINARY,
00040     LS_MAT7_BINARY,
00041 #ifdef HAVE_HDF5
00042     LS_HDF5,
00043 #endif /* HAVE_HDF5 */
00044     LS_UNKNOWN
00045   };
00046 
00047 enum load_save_format_options
00048 {
00049   // LS_MAT_ASCII options (not exclusive)
00050   LS_MAT_ASCII_LONG = 1,
00051   LS_MAT_ASCII_TABS = 2,
00052   // LS_MAT_BINARY options
00053   LS_MAT_BINARY_V5 = 1,
00054   LS_MAT_BINARY_V7,
00055   // zero means no option.
00056   LS_NO_OPTION = 0
00057 };
00058 
00059 class load_save_format
00060 {
00061 public:
00062   load_save_format (load_save_format_type t,
00063                     load_save_format_options o = LS_NO_OPTION)
00064     : type (t), opts (o) { }
00065   operator int (void) const
00066     { return type; }
00067   int type, opts;
00068 };
00069 
00070 extern void dump_octave_core (void);
00071 
00072 extern int
00073 read_binary_file_header (std::istream& is, bool& swap,
00074                          oct_mach_info::float_format& flt_fmt,
00075                          bool quiet = false);
00076 
00077 extern octave_value
00078 do_load (std::istream& stream, const std::string& orig_fname,
00079          load_save_format format, oct_mach_info::float_format flt_fmt,
00080          bool list_only, bool swap, bool verbose,
00081          const string_vector& argv, int argv_idx, int argc, int nargout);
00082 
00083 extern void
00084 do_save (std::ostream& os, const symbol_table::symbol_record& sr,
00085          load_save_format fmt, bool save_as_floats);
00086 
00087 extern void
00088 write_header (std::ostream& os, load_save_format format);
00089 
00090 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines