annotate src/oct-obj.h @ 14616:13cc11418393

improve handling of default resize fill value for arrays * Array.cc (Array<T>::resize_fill_value): Return T, not const T&. * Array.h (Array<T>::resize_fill_value): Now virtual member function instead of static. (Array<T>::resize1 (octave_idx_type)): New function. (Array<T>::resize1 (octave_idx_type, const T&)): Eliminate default value for second arg. (Array<T>::resize (octave_idx_type, octave_idx_type)): New function. (Array<T>::resize (octave_idx_type, octave_idx_type, const T&)): Eliminate default value for third arg. (Array<T>::resize (const dim_vector&)): New function. (Array<T>::resize (const dim_vector&, const T&)): New function. (Array<T>::resize2 (octave_idx_type, octave_idx_type)): New function. (Array<T>::resize2 (octave_idx_type, octave_idx_type, const T&)): Eliminate default value for third arg. (Array<T>::index (const idx_vector&, bool) const): New function. (Array<T>::index (const idx_vector&, bool, const T&) const): Eliminate default value for third arg. (Array<T>::index (const idx_vector&, const idx_vector&, bool) const): New function. (Array<T>::index (const idx_vector&, const idx_vector&, bool, const T&) const): Eliminate default value for third arg. (Array<T>::index (const Array<idx_vector>&, bool) const): New function. (Array<T>::index (const Array<idx_vector>&, const T&) const): Eliminate default value for third arg. (Array<T>::assign (const idx_vector&, const Array<T>&)): New function. (Array<T>::assign (const idx_vector&, const Array<T>&, const T&)): Eliminate default value for third arg. (Array<T>::assign (const idx_vector&, const idx_vector&, const Array<T>&)): New function. (Array<T>::assign (const idx_vector&, const idx_vector&, const Array<T>&, const T&)): Eliminate default value for third arg. (Array<T>::assign (const Array<idx_vector>&, const Array<T>&)): New function. (Array<T>::assign (const Array<idx_vector>&, const Array<T>&, const T&)): Eliminate default value for third arg. * DiagArray2.h (DiagArray2<T>::resize (octave_idx_type, octave_idx_type)): New function. (DiagArray2<T>::resize (octave_idx_type, octave_idx_type, const T&)): Eliminate default value for third arg. * CColVector.h (ComplexColumnVector::resize): Use Complex (0) as default value instead of Array<Complex>::resize_fill_value (). * CMatrix.h (ComplexMatrix::resize): Use Complex (0) as default value instead of Array<Complex>::resize_fill_value (). (ComplexMatrix::resize_fill_value): Delete. * CNDArray.h (ComplexNDArray::resize_fill_value): Delete. * CRowVector.h (ComplexRowVector::resize): Use Complex (0) as default value instead of Array<Complex>::resize_fill_value (). * boolMatrix.h (boolMatrix::resize): Use false as default value instead of resize_fill_value (). (boolMatrix::resize_fill_value): Delete. * boolNDArray.h (boolNDArray::resize_fill_value): Delete. * chMatrix.h (charMatrix::resize): Use 0 as default value instead of resize_fill_value. (charMatrix::resize_fill_value): Delete. * chNDArray.h (charNDArray::resize_fill_value): Delete. * dColVector.h (ColumnVector::resize): Use 0 as default value instead of Array<double>::resize_fill_value (). * dMatrix.h (Matrix::resize): Use 0 as default value instead of resize_fill_value (). (Matrix::resize_fill_value): Delete. * dNDArray.h (NDArray::resize_fill_value): Delete. * dRowVector.h (RowVector::resize): Use 0 as default value instead of Array<double>::resize_fill_value (). * fCColVector.h (FloatComplexColumnVector::resize): Use FloatComplex (0) as default value instead of Array<FloatComplex>::resize_fill_value (). * fCMatrix.h (FloatComplexMatrix::resize): Use FloatComplex (0) as default value instead of resize_fill_value ()). FloatCmplexMatrix::resize_fill_value): Delete. * fCNDArray.h (FloatComplexNDArray::resize_fill_value): Delete. * fCRowVector.h (FloatComplexRowVector::resize): Use FloatComplex (0) as default value instead of Array<FloatComplex>::resize_fill_value (). * fColVector.h (FloatColumnVector::resize): Use 0 as default value instead of Array<float>::resize_fill_value (). * fMatrix.h (FloatMatrix::resize): Use 0 as default value instead of resize_fill_value (). * fMatrix.h (FloatMatrix::resize_fill_value): Delete. * fNDArray.h (FloatNDArray::resize_fill_value): Delete. * fRowVector.h (FloatRowVector::resize): Use 0 as default value instead of Array<float>::resize_fill_value (). * intNDArray.h (intNDArray<T>::resize_fill_value): Delete. * str-vec.h (string_vector::resize): Use std::string as default value instead of resize_fill_value (). * Cell.cc, Cell.h (Cell::Cell, Cell::assign, Cell::index): Use Matrix () as default value instead of resize_fill_value (). (Cell::resize_fill_value): No longer static. * oct-map.cc (octave_map::resize, octave_map::assign, Octave_map::resize, Octave_map::assign): Use Matrix () as default value instead of Cell::resize_fill_value. * oct-obj.h (octave_value_list::resize): Use octave_value () instead of Array<octave_value>::resize_fill_value (). * ov-complex.cc (octave_complex::resize): Use Complex (0) for fill value instead of ComplexNDArray::resize_fill_value (). * ov-float.cc (octave_float_scalar::resize): Use 0 for fill value instead of NDArray::resize_fill_value (). * ov-flt-complex.cc (octave_float_complex_scalar::resize): Use Complex (0) for fill value instead of ComplexNDArray::resize_fill_value (). * ov-range.cc (octave_range::resize): Use 0 for fill value instead of NDArray::resize_fill_value (). * ov-scalar.cc (octave_scalar::resize): Use 0 for fill value instead of NDArray::resize_fill_value (). * ov-str-mat.cc (octave_char_matrix_str::resize): Use 0 for fill value instead of charNDArray::resize_fill_value ().
author John W. Eaton <jwe@octave.org>
date Thu, 10 May 2012 16:31:02 -0400
parents 72c96de7a403
children 460a3c6d8bf1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
498
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
1 /*
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
2
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 13917
diff changeset
3 Copyright (C) 1994-2012 John W. Eaton
8580
188d38a553c7 further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents: 8579
diff changeset
4 Copyright (C) 2009 VZLU Prague
498
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
5
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
7
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6335
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6335
diff changeset
11 option) any later version.
498
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
12
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
16 for more details.
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
17
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6335
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6335
diff changeset
20 <http://www.gnu.org/licenses/>.
498
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
21
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
22 */
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
23
504
be155b3d5a2f [project @ 1994-07-08 23:45:33 by jwe]
jwe
parents: 498
diff changeset
24 #if !defined (octave_oct_obj_h)
be155b3d5a2f [project @ 1994-07-08 23:45:33 by jwe]
jwe
parents: 498
diff changeset
25 #define octave_oct_obj_h 1
be155b3d5a2f [project @ 1994-07-08 23:45:33 by jwe]
jwe
parents: 498
diff changeset
26
1968
a2e206524aa0 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents: 1884
diff changeset
27 #include <string>
4591
2c9de1be042a [project @ 2003-11-11 00:23:35 by jwe]
jwe
parents: 4548
diff changeset
28 #include <vector>
1968
a2e206524aa0 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents: 1884
diff changeset
29
2970
b9e64477f703 [project @ 1997-05-15 18:04:21 by jwe]
jwe
parents: 2951
diff changeset
30 #include "oct-alloc.h"
2943
e6dfc3ea6299 [project @ 1997-05-08 02:31:59 by jwe]
jwe
parents: 2877
diff changeset
31 #include "str-vec.h"
8579
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
32 #include "Array.h"
498
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
33
2369
5ece30fb2af6 [project @ 1996-10-11 23:47:45 by jwe]
jwe
parents: 2086
diff changeset
34 #include "ov.h"
8579
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
35 #include "Cell.h"
498
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
36
737
5eb0d9359485 [project @ 1994-09-25 18:35:49 by jwe]
jwe
parents: 574
diff changeset
37 class
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5846
diff changeset
38 OCTINTERP_API
2872
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
39 octave_value_list
508
ef71e51a2280 [project @ 1994-07-10 02:06:07 by jwe]
jwe
parents: 504
diff changeset
40 {
ef71e51a2280 [project @ 1994-07-10 02:06:07 by jwe]
jwe
parents: 504
diff changeset
41 public:
ef71e51a2280 [project @ 1994-07-10 02:06:07 by jwe]
jwe
parents: 504
diff changeset
42
2086
bfb775fb6fe8 [project @ 1996-04-25 05:55:19 by jwe]
jwe
parents: 1996
diff changeset
43 octave_value_list (void)
11581
6006ca07410d another data member initialization fix
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
44 : data (), names () { }
1968
a2e206524aa0 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents: 1884
diff changeset
45
9545
8670e55078fd allow constructing octave_value_list from size
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
46 explicit octave_value_list (octave_idx_type n)
11581
6006ca07410d another data member initialization fix
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
47 : data (dim_vector (1, n)), names () { }
9545
8670e55078fd allow constructing octave_value_list from size
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
48
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
49 octave_value_list (octave_idx_type n, const octave_value& val)
11581
6006ca07410d another data member initialization fix
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
50 : data (dim_vector (1, n), val), names () { }
511
08a3f07adc78 [project @ 1994-07-12 17:58:03 by jwe]
jwe
parents: 508
diff changeset
51
2086
bfb775fb6fe8 [project @ 1996-04-25 05:55:19 by jwe]
jwe
parents: 1996
diff changeset
52 octave_value_list (const octave_value& tc)
11581
6006ca07410d another data member initialization fix
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
53 : data (dim_vector (1, 1), tc), names () { }
1968
a2e206524aa0 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents: 1884
diff changeset
54
8579
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
55 octave_value_list (const Array<octave_value>& d)
11581
6006ca07410d another data member initialization fix
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
56 : data (d.as_row ()), names () { }
8579
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
57
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
58 octave_value_list (const Cell& tc)
11581
6006ca07410d another data member initialization fix
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
59 : data (tc.as_row ()), names () { }
8546
3d8a914c580e improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents: 8523
diff changeset
60
2086
bfb775fb6fe8 [project @ 1996-04-25 05:55:19 by jwe]
jwe
parents: 1996
diff changeset
61 octave_value_list (const octave_value_list& obj)
4150
0d411821682c [project @ 2002-11-04 22:03:05 by jwe]
jwe
parents: 4066
diff changeset
62 : data (obj.data), names (obj.names) { }
508
ef71e51a2280 [project @ 1994-07-10 02:06:07 by jwe]
jwe
parents: 504
diff changeset
63
8580
188d38a553c7 further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents: 8579
diff changeset
64 // Concatenation constructor.
188d38a553c7 further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents: 8579
diff changeset
65 octave_value_list (const std::list<octave_value_list>&);
188d38a553c7 further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents: 8579
diff changeset
66
4189
047d21dd1890 [project @ 2002-11-19 21:08:57 by jwe]
jwe
parents: 4150
diff changeset
67 ~octave_value_list (void) { }
047d21dd1890 [project @ 2002-11-19 21:08:57 by jwe]
jwe
parents: 4150
diff changeset
68
2086
bfb775fb6fe8 [project @ 1996-04-25 05:55:19 by jwe]
jwe
parents: 1996
diff changeset
69 octave_value_list& operator = (const octave_value_list& obj)
508
ef71e51a2280 [project @ 1994-07-10 02:06:07 by jwe]
jwe
parents: 504
diff changeset
70 {
1968
a2e206524aa0 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents: 1884
diff changeset
71 if (this != &obj)
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10181
diff changeset
72 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10181
diff changeset
73 data = obj.data;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10181
diff changeset
74 names = obj.names;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10181
diff changeset
75 }
1968
a2e206524aa0 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents: 1884
diff changeset
76
508
ef71e51a2280 [project @ 1994-07-10 02:06:07 by jwe]
jwe
parents: 504
diff changeset
77 return *this;
ef71e51a2280 [project @ 1994-07-10 02:06:07 by jwe]
jwe
parents: 504
diff changeset
78 }
ef71e51a2280 [project @ 1994-07-10 02:06:07 by jwe]
jwe
parents: 504
diff changeset
79
8579
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
80 Array<octave_value> array_value (void) const { return data; }
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
81
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
82 Cell cell_value (void) const { return array_value (); }
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
83
2872
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
84 // Assignment will resize on range errors.
508
ef71e51a2280 [project @ 1994-07-10 02:06:07 by jwe]
jwe
parents: 504
diff changeset
85
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
86 octave_value& operator () (octave_idx_type n) { return elem (n); }
1968
a2e206524aa0 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents: 1884
diff changeset
87
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9545
diff changeset
88 const octave_value& operator () (octave_idx_type n) const { return elem (n); }
526
a01a9db8ab69 [project @ 1994-07-20 18:46:24 by jwe]
jwe
parents: 511
diff changeset
89
8579
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
90 octave_idx_type length (void) const { return data.length (); }
2872
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
91
2951
ab9673e3bb5d [project @ 1997-05-09 14:46:19 by jwe]
jwe
parents: 2943
diff changeset
92 bool empty (void) const { return length () == 0; }
ab9673e3bb5d [project @ 1997-05-09 14:46:19 by jwe]
jwe
parents: 2943
diff changeset
93
14616
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
94 void resize (octave_idx_type n, const octave_value& rfv = octave_value ())
11574
a83bad07f7e3 attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
95 {
a83bad07f7e3 attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
96 data.resize (dim_vector (1, n), rfv);
a83bad07f7e3 attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
97 }
2872
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
98
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
99 octave_value_list& prepend (const octave_value& val);
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
100
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
101 octave_value_list& append (const octave_value& val);
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
102
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
103 octave_value_list& append (const octave_value_list& lst);
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
104
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
105 octave_value_list& reverse (void);
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
106
6335
de4ae354c831 [project @ 2007-02-21 18:19:07 by jwe]
jwe
parents: 6109
diff changeset
107 octave_value_list
10659
8baff2aceabc fix slicing value lists with name tags (bug #29960)
Jaroslav Hajek <highegg@gmail.com>
parents: 10350
diff changeset
108 slice (octave_idx_type offset, octave_idx_type len, bool tags = false) const
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11581
diff changeset
109 {
10659
8baff2aceabc fix slicing value lists with name tags (bug #29960)
Jaroslav Hajek <highegg@gmail.com>
parents: 10350
diff changeset
110 octave_value_list retval (data.linear_slice (offset, offset + len));
8baff2aceabc fix slicing value lists with name tags (bug #29960)
Jaroslav Hajek <highegg@gmail.com>
parents: 10350
diff changeset
111 if (tags && len > 0 && names.length () > 0)
8baff2aceabc fix slicing value lists with name tags (bug #29960)
Jaroslav Hajek <highegg@gmail.com>
parents: 10350
diff changeset
112 retval.names = names.linear_slice (offset, std::min (len, names.length ()));
8baff2aceabc fix slicing value lists with name tags (bug #29960)
Jaroslav Hajek <highegg@gmail.com>
parents: 10350
diff changeset
113
8baff2aceabc fix slicing value lists with name tags (bug #29960)
Jaroslav Hajek <highegg@gmail.com>
parents: 10350
diff changeset
114 return retval;
8baff2aceabc fix slicing value lists with name tags (bug #29960)
Jaroslav Hajek <highegg@gmail.com>
parents: 10350
diff changeset
115 }
8579
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
116
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
117 octave_value_list
6335
de4ae354c831 [project @ 2007-02-21 18:19:07 by jwe]
jwe
parents: 6109
diff changeset
118 splice (octave_idx_type offset, octave_idx_type len,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10181
diff changeset
119 const octave_value_list& lst = octave_value_list ()) const;
3195
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 2970
diff changeset
120
2872
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
121 bool all_strings_p (void) const;
1968
a2e206524aa0 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents: 1884
diff changeset
122
8455
fd11a08a9b31 disallow invalid {}-indexed assigments
Jaroslav Hajek <highegg@gmail.com>
parents: 8437
diff changeset
123 bool all_scalars (void) const;
fd11a08a9b31 disallow invalid {}-indexed assigments
Jaroslav Hajek <highegg@gmail.com>
parents: 8437
diff changeset
124
10086
76df75b10c80 allow more cells in strfind/strrep + supply a general mechanism
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
125 bool any_cell (void) const;
76df75b10c80 allow more cells in strfind/strrep + supply a general mechanism
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
126
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
127 bool has_magic_colon (void) const;
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
128
8034
f61bd8e0d682 fix default_save_options parsing and allow mixing options with other arguments.
Jaroslav Hajek <highegg@gmail.com>
parents: 7017
diff changeset
129 string_vector make_argv (const std::string& = std::string()) const;
526
a01a9db8ab69 [project @ 1994-07-20 18:46:24 by jwe]
jwe
parents: 511
diff changeset
130
2943
e6dfc3ea6299 [project @ 1997-05-08 02:31:59 by jwe]
jwe
parents: 2877
diff changeset
131 void stash_name_tags (const string_vector& nm) { names = nm; }
e6dfc3ea6299 [project @ 1997-05-08 02:31:59 by jwe]
jwe
parents: 2877
diff changeset
132
e6dfc3ea6299 [project @ 1997-05-08 02:31:59 by jwe]
jwe
parents: 2877
diff changeset
133 string_vector name_tags (void) const { return names; }
e6dfc3ea6299 [project @ 1997-05-08 02:31:59 by jwe]
jwe
parents: 2877
diff changeset
134
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8455
diff changeset
135 void make_storable_values (void);
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8034
diff changeset
136
10181
a668fbd32e34 improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
137 octave_value& xelem (octave_idx_type i)
a668fbd32e34 improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
138 {
a668fbd32e34 improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
139 return data.xelem (i);
a668fbd32e34 improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
140 }
a668fbd32e34 improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
141
a668fbd32e34 improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
142 void clear (void)
a668fbd32e34 improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
143 {
a668fbd32e34 improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
144 data.clear ();
a668fbd32e34 improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
145 }
a668fbd32e34 improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
146
526
a01a9db8ab69 [project @ 1994-07-20 18:46:24 by jwe]
jwe
parents: 511
diff changeset
147 private:
508
ef71e51a2280 [project @ 1994-07-10 02:06:07 by jwe]
jwe
parents: 504
diff changeset
148
8579
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
149 Array<octave_value> data;
2872
6285237ed3b9 [project @ 1997-04-19 01:30:58 by jwe]
jwe
parents: 2847
diff changeset
150
2943
e6dfc3ea6299 [project @ 1997-05-08 02:31:59 by jwe]
jwe
parents: 2877
diff changeset
151 // This list of strings can be used to tag each element of data with
e6dfc3ea6299 [project @ 1997-05-08 02:31:59 by jwe]
jwe
parents: 2877
diff changeset
152 // a name. By default, it is empty.
e6dfc3ea6299 [project @ 1997-05-08 02:31:59 by jwe]
jwe
parents: 2877
diff changeset
153 string_vector names;
e6dfc3ea6299 [project @ 1997-05-08 02:31:59 by jwe]
jwe
parents: 2877
diff changeset
154
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
155 octave_value& elem (octave_idx_type n)
1968
a2e206524aa0 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents: 1884
diff changeset
156 {
8579
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
157 if (n >= length ())
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10181
diff changeset
158 resize (n + 1);
4591
2c9de1be042a [project @ 2003-11-11 00:23:35 by jwe]
jwe
parents: 4548
diff changeset
159
8579
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
160 return data(n);
1968
a2e206524aa0 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents: 1884
diff changeset
161 }
a2e206524aa0 [project @ 1996-02-17 02:54:24 by jwe]
jwe
parents: 1884
diff changeset
162
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9545
diff changeset
163 const octave_value& elem (octave_idx_type n) const
8579
7e0f36dfefbe implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents: 8546
diff changeset
164 { return data(n); }
13917
826f008c829b * oct-obj.h, oct-obj.cc: Use macros to declare and define octave_allocator.
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
165
826f008c829b * oct-obj.h, oct-obj.cc: Use macros to declare and define octave_allocator.
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
166 DECLARE_OCTAVE_ALLOCATOR
508
ef71e51a2280 [project @ 1994-07-10 02:06:07 by jwe]
jwe
parents: 504
diff changeset
167 };
498
2e1353465468 [project @ 1994-07-08 02:08:49 by jwe]
jwe
parents:
diff changeset
168
504
be155b3d5a2f [project @ 1994-07-08 23:45:33 by jwe]
jwe
parents: 498
diff changeset
169 #endif