annotate libinterp/octave-value/ov-bool.h @ 29358:0a5b15007766 stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Feb 2021 09:52:15 -0500
parents bd51beb6205e
children 7854d5752dd2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
3 // Copyright (C) 1996-2021 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19863
diff changeset
26 #if ! defined (octave_ov_bool_h)
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
27 #define octave_ov_bool_h 1
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21066
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21066
diff changeset
30
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
31 #include <cstdlib>
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
32
8950
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
33 #include <iosfwd>
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
34 #include <string>
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
35
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
36 #include "lo-utils.h"
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
37 #include "mx-base.h"
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
38 #include "str-vec.h"
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
39
4970
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4915
diff changeset
40 #include "oct-stream.h"
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
41 #include "ov-base.h"
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3219
diff changeset
42 #include "ov-base-scalar.h"
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10343
diff changeset
43 #include "ov-bool-mat.h"
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
44 #include "ov-scalar.h"
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
45 #include "ov-typeinfo.h"
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
46
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
47 class octave_value_list;
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
48
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
49 // Real scalar values.
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
50
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
51 class
10343
2ef5144ccb0d Add few OCTINTERP_API tags.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10313
diff changeset
52 OCTINTERP_API
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3219
diff changeset
53 octave_bool : public octave_base_scalar<bool>
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
54 {
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
55 public:
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
56
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
57 octave_bool (void)
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3219
diff changeset
58 : octave_base_scalar<bool> (false) { }
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
59
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
60 octave_bool (bool b)
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3219
diff changeset
61 : octave_base_scalar<bool> (b) { }
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
62
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
63 octave_bool (const octave_bool& s)
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3219
diff changeset
64 : octave_base_scalar<bool> (s) { }
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
65
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22861
diff changeset
66 ~octave_bool (void) = default;
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
67
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
68 octave_base_value * clone (void) const { return new octave_bool (*this); }
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
69 octave_base_value * empty_clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
70 { return new octave_bool_matrix (); }
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
71
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8202
diff changeset
72 type_conv_info numeric_conversion_function (void) const;
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
73
5885
bd3041e30d97 [project @ 2006-07-14 20:29:35 by jwe]
jwe
parents: 5881
diff changeset
74 octave_value do_index_op (const octave_value_list& idx,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
75 bool resize_ok = false);
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
76
18130
e473c4853afc enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
77 idx_vector index_vector (bool /* require_integers */ = false) const { return idx_vector (scalar); }
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
78
9685
e793865ede63 implement builtin_type
Jaroslav Hajek <highegg@gmail.com>
parents: 8950
diff changeset
79 builtin_type_t builtin_type (void) const { return btyp_bool; }
e793865ede63 implement builtin_type
Jaroslav Hajek <highegg@gmail.com>
parents: 8950
diff changeset
80
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
81 bool is_real_scalar (void) const { return true; }
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
82
5881
70b3f8f1a793 [project @ 2006-07-08 03:54:17 by jwe]
jwe
parents: 5759
diff changeset
83 bool is_bool_scalar (void) const { return true; }
70b3f8f1a793 [project @ 2006-07-08 03:54:17 by jwe]
jwe
parents: 5759
diff changeset
84
23579
c20a0fa91c0c maint: Deprecate is_bool_type and replace with islogical.
Rik <rik@octave.org>
parents: 23446
diff changeset
85 bool islogical (void) const { return true; }
3209
fbb332b96e4f [project @ 1998-11-03 20:48:54 by jwe]
jwe
parents: 3203
diff changeset
86
23582
0cc2011d800e maint: Deprecate is_real_type and replace with isreal.
Rik <rik@octave.org>
parents: 23579
diff changeset
87 bool isreal (void) const { return true; }
3209
fbb332b96e4f [project @ 1998-11-03 20:48:54 by jwe]
jwe
parents: 3203
diff changeset
88
23586
f6c5db0a02e7 maint: Deprecate is_numeric_type and replace with isnumeric.
Rik <rik@octave.org>
parents: 23582
diff changeset
89 bool isnumeric (void) const { return false; }
9841
6f1ea8241c99 make isnumeric yield false on logicals
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
90
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
91 bool is_true (void) const { return scalar; }
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
92
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
93 int8NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
94 int8_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
95 { return int8NDArray (dim_vector (1, 1), scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
96
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
97 int16NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
98 int16_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
99 { return int16NDArray (dim_vector (1, 1), scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
100
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
101 int32NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
102 int32_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
103 { return int32NDArray (dim_vector (1, 1), scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
104
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
105 int64NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
106 int64_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
107 { return int64NDArray (dim_vector (1, 1), scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
108
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
109 uint8NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
110 uint8_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
111 { return uint8NDArray (dim_vector (1, 1), scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
112
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
113 uint16NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
114 uint16_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
115 { return uint16NDArray (dim_vector (1, 1), scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
116
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
117 uint32NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
118 uint32_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
119 { return uint32NDArray (dim_vector (1, 1), scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
120
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
121 uint64NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
122 uint64_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
123 { return uint64NDArray (dim_vector (1, 1), scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
124
13142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
125 octave_int8
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
126 int8_scalar_value (void) const { return octave_int8 (scalar); }
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
127
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
128 octave_int16
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
129 int16_scalar_value (void) const { return octave_int16 (scalar); }
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
130
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
131 octave_int32
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
132 int32_scalar_value (void) const { return octave_int32 (scalar); }
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
133
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
134 octave_int64
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
135 int64_scalar_value (void) const { return octave_int64 (scalar); }
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
136
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
137 octave_uint8
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
138 uint8_scalar_value (void) const { return octave_uint8 (scalar); }
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
139
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
140 octave_uint16
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
141 uint16_scalar_value (void) const { return octave_uint16 (scalar); }
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
142
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
143 octave_uint32
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
144 uint32_scalar_value (void) const { return octave_uint32 (scalar); }
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
145
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
146 octave_uint64
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
147 uint64_scalar_value (void) const { return octave_uint64 (scalar); }
d803d2702a39 improve compatibility of concatenation (bug #33966)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
148
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
149 double double_value (bool = false) const { return scalar; }
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
150
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
151 float float_value (bool = false) const { return scalar; }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
152
2916
4e7bea116f24 [project @ 1997-04-30 20:56:31 by jwe]
jwe
parents: 2911
diff changeset
153 double scalar_value (bool = false) const { return scalar; }
4e7bea116f24 [project @ 1997-04-30 20:56:31 by jwe]
jwe
parents: 2911
diff changeset
154
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
155 float float_scalar_value (bool = false) const { return scalar; }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
156
3145
0d640dc625c7 [project @ 1998-02-05 08:44:59 by jwe]
jwe
parents: 2974
diff changeset
157 Matrix matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
158 { return Matrix (1, 1, scalar); }
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
159
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
160 FloatMatrix float_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
161 { return FloatMatrix (1, 1, scalar); }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
162
4630
ca70857bdbd1 [project @ 2003-11-18 18:18:16 by jwe]
jwe
parents: 4612
diff changeset
163 NDArray array_value (bool = false) const
22861
0ab9c3548b1f avoid some double to float conversion warnings
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
164 { return NDArray (dim_vector (1, 1), double_value ()); }
4630
ca70857bdbd1 [project @ 2003-11-18 18:18:16 by jwe]
jwe
parents: 4612
diff changeset
165
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
166 FloatNDArray float_array_value (bool = false) const
22861
0ab9c3548b1f avoid some double to float conversion warnings
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
167 { return FloatNDArray (dim_vector (1, 1), float_value ()); }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
168
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
169 Complex complex_value (bool = false) const { return scalar; }
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
170
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
171 FloatComplex float_complex_value (bool = false) const { return scalar; }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
172
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
173 ComplexMatrix complex_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
174 { return ComplexMatrix (1, 1, Complex (scalar)); }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
175
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
176 FloatComplexMatrix float_complex_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
177 { return FloatComplexMatrix (1, 1, FloatComplex (scalar)); }
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
178
4630
ca70857bdbd1 [project @ 2003-11-18 18:18:16 by jwe]
jwe
parents: 4612
diff changeset
179 ComplexNDArray complex_array_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
180 { return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); }
4630
ca70857bdbd1 [project @ 2003-11-18 18:18:16 by jwe]
jwe
parents: 4612
diff changeset
181
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
182 FloatComplexNDArray float_complex_array_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
183 { return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)); }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
184
6099
2b065bbbd1c2 [project @ 2006-10-26 15:56:30 by jwe]
jwe
parents: 5958
diff changeset
185 SparseMatrix sparse_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
186 { return SparseMatrix (Matrix (1, 1, scalar)); }
6099
2b065bbbd1c2 [project @ 2006-10-26 15:56:30 by jwe]
jwe
parents: 5958
diff changeset
187
21066
258c787cd9ce maint: Use "FIXME:" consistently in code base.
Rik <rik@octave.org>
parents: 20791
diff changeset
188 // FIXME: Need SparseComplexMatrix (Matrix) constructor!
6099
2b065bbbd1c2 [project @ 2006-10-26 15:56:30 by jwe]
jwe
parents: 5958
diff changeset
189 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
190 { return SparseComplexMatrix (sparse_matrix_value ()); }
6099
2b065bbbd1c2 [project @ 2006-10-26 15:56:30 by jwe]
jwe
parents: 5958
diff changeset
191
2b065bbbd1c2 [project @ 2006-10-26 15:56:30 by jwe]
jwe
parents: 5958
diff changeset
192 SparseBoolMatrix sparse_bool_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
193 { return SparseBoolMatrix (boolMatrix (1, 1, scalar)); }
6099
2b065bbbd1c2 [project @ 2006-10-26 15:56:30 by jwe]
jwe
parents: 5958
diff changeset
194
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
195 charNDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
196 char_array_value (bool = false) const
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
197 {
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
198 charNDArray retval (dim_vector (1, 1));
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
199 retval(0) = static_cast<char> (scalar);
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
200 return retval;
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
201 }
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
202
5944
d20c596b9b10 [project @ 2006-08-18 21:34:00 by jwe]
jwe
parents: 5900
diff changeset
203 bool bool_value (bool = false) const { return scalar; }
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
204
5944
d20c596b9b10 [project @ 2006-08-18 21:34:00 by jwe]
jwe
parents: 5900
diff changeset
205 boolMatrix bool_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
206 { return boolMatrix (1, 1, scalar); }
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
207
5944
d20c596b9b10 [project @ 2006-08-18 21:34:00 by jwe]
jwe
parents: 5900
diff changeset
208 boolNDArray bool_array_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
209 { return boolNDArray (dim_vector (1, 1), scalar); }
4847
83ddfedb8db7 [project @ 2004-04-02 21:15:34 by jwe]
jwe
parents: 4687
diff changeset
210
22296
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
211 octave_value as_double (void) const;
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
212 octave_value as_single (void) const;
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
213
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
214 octave_value as_int8 (void) const;
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
215 octave_value as_int16 (void) const;
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
216 octave_value as_int32 (void) const;
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
217 octave_value as_int64 (void) const;
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
218
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
219 octave_value as_uint8 (void) const;
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
220 octave_value as_uint16 (void) const;
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
221 octave_value as_uint32 (void) const;
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
222 octave_value as_uint64 (void) const;
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
223
5731
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5533
diff changeset
224 octave_value resize (const dim_vector& dv, bool fill = false) const;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4847
diff changeset
225
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5105
diff changeset
226 octave_value convert_to_str_internal (bool pad, bool force, char type) const;
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
227
6974
9e32bb109980 [project @ 2007-10-08 11:06:47 by jwe]
jwe
parents: 6099
diff changeset
228 bool save_ascii (std::ostream& os);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4630
diff changeset
229
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4630
diff changeset
230 bool load_ascii (std::istream& is);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4630
diff changeset
231
26399
586413770c7f pass save_as_floats by value in octave_value save_binary functions
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
232 bool save_binary (std::ostream& os, bool save_as_floats);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4630
diff changeset
233
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
234 bool load_binary (std::istream& is, bool swap,
21739
c4ab2e54f100 use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
235 octave::mach_info::float_format fmt);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4630
diff changeset
236
19863
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19697
diff changeset
237 bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4630
diff changeset
238
19863
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19697
diff changeset
239 bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4630
diff changeset
240
23059
b98ebcd7f11c move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
241 int write (octave::stream& os, int block_size,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
242 oct_data_conv::data_type output_type, int skip,
21739
c4ab2e54f100 use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
243 octave::mach_info::float_format flt_fmt) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
244 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
245 return os.write (bool_array_value (), block_size, output_type,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
246 skip, flt_fmt);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
247 }
4970
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4915
diff changeset
248
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
249 mxArray * as_mxArray (void) const;
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
250
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
251 // Mapper functions are converted to double for treatment
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9685
diff changeset
252 octave_value map (unary_mapper_t umap) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
253 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
254 octave_scalar m (scalar_value ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
255 return m.map (umap);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
256 }
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
257
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
258 private:
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
259
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4457
diff changeset
260 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
2871
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
261 };
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
262
c691fdf6bebb [project @ 1997-04-19 01:26:38 by jwe]
jwe
parents:
diff changeset
263 #endif