comparison src/ov-base-int.h @ 4903:bfe64e459ce3

[project @ 2004-06-14 19:20:26 by jwe]
author jwe
date Mon, 14 Jun 2004 19:20:26 +0000
parents
children f69e95587ba3
comparison
equal deleted inserted replaced
4902:bd043a433918 4903:bfe64e459ce3
1 /*
2
3 Copyright (C) 2004 John W. Eaton
4
5 This file is part of Octave.
6
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
10 later version.
11
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 */
22
23 #if !defined (octave_base_int_matrix_h)
24 #define octave_base_int_matrix_h 1
25
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
27 #pragma interface
28 #endif
29
30 #include <cstdlib>
31
32 #include <iostream>
33 #include <string>
34
35 #include "mx-base.h"
36 #include "oct-alloc.h"
37 #include "so-array.h"
38 #include "str-vec.h"
39
40 #include "error.h"
41 #include "ov-base.h"
42 #include "ov-base-mat.h"
43 #include "ov-base-scalar.h"
44 #include "ov-typeinfo.h"
45
46 // base int matrix values.
47
48 template <class T>
49 class
50 octave_base_int_matrix : public octave_base_matrix<T>
51 {
52 public:
53
54 octave_base_int_matrix (void) : octave_base_matrix<T> () { }
55
56 octave_base_int_matrix (const T& nda) : octave_base_matrix<T> (nda) { }
57
58 ~octave_base_int_matrix (void) { }
59
60 octave_value *clone (void) const { return new octave_base_int_matrix (*this); }
61 octave_value *empty_clone (void) const { return new octave_base_int_matrix (); }
62
63 octave_value *try_narrowing_conversion (void);
64
65 bool is_real_type (void) const { return true; }
66
67 // void increment (void) { matrix += 1; }
68
69 // void decrement (void) { matrix -= 1; }
70
71 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
72
73 bool save_ascii (std::ostream& os, bool& infnan_warned,
74 bool strip_nan_and_inf);
75
76 bool load_ascii (std::istream& is);
77
78 bool save_binary (std::ostream& os, bool& save_as_floats);
79
80 bool load_binary (std::istream& is, bool swap,
81 oct_mach_info::float_format fmt);
82
83 #if defined (HAVE_HDF5)
84 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
85
86 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug);
87 #endif
88 };
89
90 // base int scalar values.
91
92 template <class T>
93 class
94 octave_base_int_scalar : public octave_base_scalar<T>
95 {
96 public:
97
98 octave_base_int_scalar (void) : octave_base_scalar<T> () { }
99
100 octave_base_int_scalar (const T& s) : octave_base_scalar<T> (s) { }
101
102 ~octave_base_int_scalar (void) { }
103
104 octave_value *clone (void) const { return new octave_base_int_scalar (*this); }
105 octave_value *empty_clone (void) const { return new octave_base_int_scalar (); }
106
107 octave_value *try_narrowing_conversion (void) { return 0; }
108
109 bool is_real_type (void) const { return true; }
110
111 // void increment (void) { scalar += 1; }
112
113 // void decrement (void) { scalar -= 1; }
114
115 bool save_ascii (std::ostream& os, bool& infnan_warned,
116 bool strip_nan_and_inf);
117
118 bool load_ascii (std::istream& is);
119
120 bool save_binary (std::ostream& os, bool& save_as_floats);
121
122 bool load_binary (std::istream& is, bool swap,
123 oct_mach_info::float_format fmt);
124
125 #if defined (HAVE_HDF5)
126 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
127
128 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug);
129 #endif
130 };
131
132 #endif
133
134 /*
135 ;;; Local Variables: ***
136 ;;; mode: C++ ***
137 ;;; End: ***
138 */