4903
|
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 |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
4903
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_base_int_matrix_h) |
|
25 #define octave_base_int_matrix_h 1 |
|
26 |
|
27 #include <cstdlib> |
|
28 |
|
29 #include <iostream> |
|
30 #include <string> |
|
31 |
|
32 #include "mx-base.h" |
|
33 #include "oct-alloc.h" |
|
34 #include "so-array.h" |
|
35 #include "str-vec.h" |
|
36 |
|
37 #include "error.h" |
|
38 #include "ov-base.h" |
|
39 #include "ov-base-mat.h" |
|
40 #include "ov-base-scalar.h" |
|
41 #include "ov-typeinfo.h" |
|
42 |
|
43 // base int matrix values. |
|
44 |
|
45 template <class T> |
|
46 class |
|
47 octave_base_int_matrix : public octave_base_matrix<T> |
|
48 { |
|
49 public: |
|
50 |
|
51 octave_base_int_matrix (void) : octave_base_matrix<T> () { } |
|
52 |
|
53 octave_base_int_matrix (const T& nda) : octave_base_matrix<T> (nda) { } |
|
54 |
|
55 ~octave_base_int_matrix (void) { } |
|
56 |
5759
|
57 octave_base_value *clone (void) const { return new octave_base_int_matrix (*this); } |
|
58 octave_base_value *empty_clone (void) const { return new octave_base_int_matrix (); } |
4903
|
59 |
5759
|
60 octave_base_value *try_narrowing_conversion (void); |
4903
|
61 |
|
62 bool is_real_type (void) const { return true; } |
|
63 |
|
64 // void increment (void) { matrix += 1; } |
|
65 |
|
66 // void decrement (void) { matrix -= 1; } |
|
67 |
|
68 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
69 |
|
70 bool save_ascii (std::ostream& os, bool& infnan_warned, |
5956
|
71 int strip_nan_and_inf); |
4903
|
72 |
|
73 bool load_ascii (std::istream& is); |
|
74 |
4917
|
75 bool save_binary (std::ostream& os, bool& ); |
4903
|
76 |
|
77 bool load_binary (std::istream& is, bool swap, |
4917
|
78 oct_mach_info::float_format ); |
4903
|
79 |
|
80 #if defined (HAVE_HDF5) |
4917
|
81 bool save_hdf5 (hid_t loc_id, const char *name, bool); |
4903
|
82 |
|
83 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
84 #endif |
|
85 }; |
|
86 |
|
87 // base int scalar values. |
|
88 |
|
89 template <class T> |
|
90 class |
|
91 octave_base_int_scalar : public octave_base_scalar<T> |
|
92 { |
|
93 public: |
|
94 |
|
95 octave_base_int_scalar (void) : octave_base_scalar<T> () { } |
|
96 |
|
97 octave_base_int_scalar (const T& s) : octave_base_scalar<T> (s) { } |
|
98 |
|
99 ~octave_base_int_scalar (void) { } |
|
100 |
5759
|
101 octave_base_value *clone (void) const { return new octave_base_int_scalar (*this); } |
|
102 octave_base_value *empty_clone (void) const { return new octave_base_int_scalar (); } |
4903
|
103 |
5759
|
104 octave_base_value *try_narrowing_conversion (void) { return 0; } |
4903
|
105 |
|
106 bool is_real_type (void) const { return true; } |
|
107 |
|
108 // void increment (void) { scalar += 1; } |
|
109 |
|
110 // void decrement (void) { scalar -= 1; } |
|
111 |
5956
|
112 bool save_ascii (std::ostream& os, bool&, int); |
4903
|
113 |
|
114 bool load_ascii (std::istream& is); |
|
115 |
4917
|
116 bool save_binary (std::ostream& os, bool& ); |
4903
|
117 |
|
118 bool load_binary (std::istream& is, bool swap, |
4917
|
119 oct_mach_info::float_format ); |
4903
|
120 |
|
121 #if defined (HAVE_HDF5) |
4917
|
122 bool save_hdf5 (hid_t loc_id, const char *name, bool ); |
4903
|
123 |
|
124 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
125 #endif |
|
126 }; |
|
127 |
|
128 #endif |
|
129 |
|
130 /* |
|
131 ;;; Local Variables: *** |
|
132 ;;; mode: C++ *** |
|
133 ;;; End: *** |
|
134 */ |