GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ov-base-int.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-2015 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 3 of the License, or (at your
10 option) any 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, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if !defined (octave_ov_base_int_h)
24 #define octave_ov_base_int_h 1
25 
26 #include <cstdlib>
27 
28 #include <iosfwd>
29 #include <string>
30 
31 #include "mx-base.h"
32 #include "str-vec.h"
33 
34 #include "error.h"
35 #include "ov-base.h"
36 #include "ov-base-mat.h"
37 #include "ov-base-scalar.h"
38 #include "ov-typeinfo.h"
39 
40 // base int matrix values.
41 
42 template <class T>
43 class
45 {
46 public:
47 
49 
50  octave_base_int_matrix (const T& nda) : octave_base_matrix<T> (nda) { }
51 
53 
54  octave_base_value *clone (void) const
55  { return new octave_base_int_matrix (*this); }
56 
58  { return new octave_base_int_matrix (); }
59 
60  octave_base_value *try_narrowing_conversion (void);
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  octave_value convert_to_str_internal (bool, bool, char type) const;
71 
72  bool save_ascii (std::ostream& os);
73 
74  bool load_ascii (std::istream& is);
75 
76  bool save_binary (std::ostream& os, bool&);
77 
78  bool load_binary (std::istream& is, bool swap,
80 
81  bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool);
82 
83  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
84 };
85 
86 // base int scalar values.
87 
88 template <class T>
89 class
91 {
92 public:
93 
95 
96  octave_base_int_scalar (const T& s) : octave_base_scalar<T> (s) { }
97 
99 
100  octave_base_value *clone (void) const
101  { return new octave_base_int_scalar (*this); }
103  { return new octave_base_int_scalar (); }
104 
106 
107  bool is_real_type (void) const { return true; }
108 
109  bool is_real_scalar (void) const { return true; }
110 
111  // void increment (void) { scalar += 1; }
112 
113  // void decrement (void) { scalar -= 1; }
114 
115  octave_value convert_to_str_internal (bool, bool, char type) const;
116 
117  bool save_ascii (std::ostream& os);
118 
119  bool load_ascii (std::istream& is);
120 
121  bool save_binary (std::ostream& os, bool&);
122 
123  bool load_binary (std::istream& is, bool swap,
125 
126  bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool);
127 
128  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
129 };
130 
131 #endif
octave_base_value * empty_clone(void) const
Definition: ov-base-int.h:102
octave_base_value * empty_clone(void) const
Definition: ov-base-int.h:57
bool is_real_type(void) const
Definition: ov-base-int.h:107
octave_base_int_scalar(const T &s)
Definition: ov-base-int.h:96
octave_base_int_matrix(const T &nda)
Definition: ov-base-int.h:50
octave_base_value * clone(void) const
Definition: ov-base-int.h:54
bool is_real_scalar(void) const
Definition: ov-base-int.h:109
octave_base_value * try_narrowing_conversion(void)
Definition: ov-base-int.h:105
bool is_real_type(void) const
Definition: ov-base-int.h:62
octave_base_value * clone(void) const
Definition: ov-base-int.h:100