GNU Octave  4.2.1
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-2017 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 "octave-config.h"
27 
28 #include <cstdlib>
29 
30 #include <iosfwd>
31 #include <string>
32 
33 #include "mx-base.h"
34 #include "str-vec.h"
35 
36 #include "error.h"
37 #include "ov-base.h"
38 #include "ov-base-mat.h"
39 #include "ov-base-scalar.h"
40 #include "ov-typeinfo.h"
41 
42 // base int matrix values.
43 
44 template <typename T>
45 class
47 {
48 public:
49 
51 
52  octave_base_int_matrix (const T& nda) : octave_base_matrix<T> (nda) { }
53 
55 
56  octave_base_value *clone (void) const
57  { return new octave_base_int_matrix (*this); }
58 
60  { return new octave_base_int_matrix (); }
61 
62  octave_base_value *try_narrowing_conversion (void);
63 
64  bool is_real_type (void) const { return true; }
65 
66  // void increment (void) { matrix += 1; }
67 
68  // void decrement (void) { matrix -= 1; }
69 
70  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
71 
72  octave_value convert_to_str_internal (bool, bool, char type) const;
73 
74  octave_value as_double (void) const;
75  octave_value as_single (void) const;
76 
77  octave_value as_int8 (void) const;
78  octave_value as_int16 (void) const;
79  octave_value as_int32 (void) const;
80  octave_value as_int64 (void) const;
81 
82  octave_value as_uint8 (void) const;
83  octave_value as_uint16 (void) const;
84  octave_value as_uint32 (void) const;
85  octave_value as_uint64 (void) const;
86 
87  bool save_ascii (std::ostream& os);
88 
89  bool load_ascii (std::istream& is);
90 
91  bool save_binary (std::ostream& os, bool&);
92 
93  bool load_binary (std::istream& is, bool swap,
95 
96  bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool);
97 
98  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
99 };
100 
101 // base int scalar values.
102 
103 template <typename T>
104 class
106 {
107 public:
108 
110 
112 
114 
115  octave_base_value *clone (void) const
116  { return new octave_base_int_scalar (*this); }
118  { return new octave_base_int_scalar (); }
119 
121 
122  bool is_real_type (void) const { return true; }
123 
124  bool is_real_scalar (void) const { return true; }
125 
126  // void increment (void) { scalar += 1; }
127 
128  // void decrement (void) { scalar -= 1; }
129 
130  octave_value convert_to_str_internal (bool, bool, char type) const;
131 
132  octave_value as_double (void) const;
133  octave_value as_single (void) const;
134 
135  octave_value as_int8 (void) const;
136  octave_value as_int16 (void) const;
137  octave_value as_int32 (void) const;
138  octave_value as_int64 (void) const;
139 
140  octave_value as_uint8 (void) const;
141  octave_value as_uint16 (void) const;
142  octave_value as_uint32 (void) const;
143  octave_value as_uint64 (void) const;
144 
145  bool save_ascii (std::ostream& os);
146 
147  bool load_ascii (std::istream& is);
148 
149  bool save_binary (std::ostream& os, bool&);
150 
151  bool load_binary (std::istream& is, bool swap,
153 
154  bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool);
155 
156  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
157 };
158 
159 #endif
octave_base_value * empty_clone(void) const
Definition: ov-base-int.h:117
octave_base_value * empty_clone(void) const
Definition: ov-base-int.h:59
bool is_real_type(void) const
Definition: ov-base-int.h:122
octave_base_int_scalar(const T &s)
Definition: ov-base-int.h:111
s
Definition: file-io.cc:2682
bool swap
Definition: load-save.cc:725
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871
octave_base_int_matrix(const T &nda)
Definition: ov-base-int.h:52
octave_base_value * clone(void) const
Definition: ov-base-int.h:56
int64_t octave_hdf5_id
idx type
Definition: ov.cc:3129
bool is_real_scalar(void) const
Definition: ov-base-int.h:124
octave_base_value * try_narrowing_conversion(void)
Definition: ov-base-int.h:120
write the output to stdout if nargout is
Definition: load-save.cc:1576
bool is_real_type(void) const
Definition: ov-base-int.h:64
octave_base_value * clone(void) const
Definition: ov-base-int.h:115