Mercurial > hg > octave-lyh
annotate libinterp/octave-value/ov-re-sparse.h @ 16468:0f143f68078d
use signal/slot for updating workspace instead of using event listener
* main-window.h, main-window.cc: Clean up list of include files.
(main_window::prepare_to_exit): Rename from prepare_to_quit. Change
all uses.
(main_window::update_workspace): Delete.
(main_window::construct): Don't connect
_octave_qt_event_listener:update_workspace_signal to
main_window::update_workspace.
(main_window::construct_octave_qt_link):
Connect _octave_qt_link::set_workspace_signal to
_workspace_model::set_workspace.
Connect _octave_qt_link::clear_workspace_signal to
_workspace_model::clear_workspace.
* symbol-information.h, symbol-information.cc: Delete
* libgui/src/module.mk (noinst_HEADERS, src_libgui_src_la_SOURCES):
Remove them from the lists.
* octave-qt-link.h, octave-qt-link.cc: Don't use symbol_information to
store workspace info.
(octave_qt_link::do_update_workspace): Delete.
(octave_qt_link::do_set_workspace,
octave_qt_link::do_clear_workspace): New functions.
(octave_qt_link::do_pre_input_event): Don't call do_update_workspace.
(octave_qt_link::set_workspace_signal,
octave_qt_link::clear_workspace_signal): New signals.
* workspace-model.h, workspace-model.cc: Don't use symbol_information
to store workspace info. Accept workspace info through a signal/slot
combination, not by asking the symbol table.
(workspace_model::request_update_workspace,
(workspace_model::update_workspace_callback): Delete.
(workspace_model::set_workspace, workspace_model::clear_workspace,
workspace_model::clear_data, workspace_model::clear_tree,
workspace_model::update_tree, workspace_model::append_tree):
New functions.
* workspace-view.h, workspace-view.cc (workspace_view::model_changed):
Don't call update_workspace_callback. The model now signals the view
when it has changed.
* input.cc (octave_base_reader::octave_gets, get_debug_input):
Call octave_link::set_workspace just prior to prompting for input.
* workspace-element.h: New file.
* libinterp/interpfcn/module.mk (INTERPFCN_INC): Include it in the list.
* octave-link.cc: Don't include symtab.h.
* octave-link.h (octave_link::update_workspace): Delete.
(octave_link::set_workspace, octave_link::do_set_workspace,
* octave_link::clear_workspace, octave_link::do_clear_workspace):
New functions.
* symtab.h, symtab.cc (symbol_table::workspace_info,
symbol_table::do_workspace_info): New functions.
* ov.h (octave_value::short_disp): New function.
* ov-base.h, ov-base.cc (octave_base_value::short_disp): New function.
* ov-base-scalar.h, ov-base-scalar.cc
(octave_base_scalar<ST>::short_disp): New function.
* ov-range.h, ov-range.cc (octave_range::short_disp): New function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 08 Apr 2013 12:01:24 -0400 |
parents | 2fc554ffbc28 |
children |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
3 Copyright (C) 2004-2012 David Bateman |
11523 | 4 Copyright (C) 1998-2004 Andy Adler |
7016 | 5 |
6 This file is part of Octave. | |
5164 | 7 |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
5164 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
5164 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_sparse_matrix_h) | |
25 #define octave_sparse_matrix_h 1 | |
26 | |
27 #include <cstdlib> | |
28 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
29 #include <iosfwd> |
5164 | 30 #include <string> |
31 | |
32 #include "mx-base.h" | |
33 #include "oct-alloc.h" | |
34 #include "str-vec.h" | |
35 | |
36 #include "error.h" | |
37 #include "oct-stream.h" | |
38 #include "ov-base.h" | |
39 #include "ov-typeinfo.h" | |
40 | |
41 #include "dSparse.h" | |
5785 | 42 #include "MatrixType.h" |
5164 | 43 #include "ov-base-sparse.h" |
44 #include "ov-cx-sparse.h" | |
45 | |
46 class octave_value_list; | |
47 | |
48 class tree_walker; | |
49 | |
50 class | |
6109 | 51 OCTINTERP_API |
5164 | 52 octave_sparse_matrix : public octave_base_sparse<SparseMatrix> |
53 { | |
54 public: | |
55 | |
56 octave_sparse_matrix (void) | |
57 : octave_base_sparse<SparseMatrix> () { } | |
58 | |
59 octave_sparse_matrix (const Matrix& m) | |
60 : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |
61 | |
62 octave_sparse_matrix (const NDArray& m) | |
63 : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |
64 | |
65 octave_sparse_matrix (const SparseMatrix& m) | |
66 : octave_base_sparse<SparseMatrix> (m) { } | |
67 | |
5785 | 68 octave_sparse_matrix (const SparseMatrix& m, const MatrixType& t) |
5164 | 69 : octave_base_sparse<SparseMatrix> (m, t) { } |
70 | |
71 octave_sparse_matrix (const MSparse<double>& m) | |
72 : octave_base_sparse<SparseMatrix> (m) { } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
73 |
6863 | 74 octave_sparse_matrix (const MSparse<double>& m, const MatrixType& t) |
75 : octave_base_sparse<SparseMatrix> (m, t) { } | |
76 | |
77 octave_sparse_matrix (const Sparse<double>& m) | |
78 : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
79 |
6863 | 80 octave_sparse_matrix (const Sparse<double>& m, const MatrixType& t) |
81 : octave_base_sparse<SparseMatrix> (SparseMatrix (m), t) { } | |
82 | |
5164 | 83 octave_sparse_matrix (const octave_sparse_matrix& m) |
84 : octave_base_sparse<SparseMatrix> (m) { } | |
85 | |
86 ~octave_sparse_matrix (void) { } | |
87 | |
5759 | 88 octave_base_value *clone (void) const { return new octave_sparse_matrix (*this); } |
89 octave_base_value *empty_clone (void) const { return new octave_sparse_matrix (); } | |
5164 | 90 |
5759 | 91 octave_base_value *try_narrowing_conversion (void); |
5164 | 92 |
5282 | 93 idx_vector index_vector (void) const; |
5164 | 94 |
9685 | 95 builtin_type_t builtin_type (void) const { return btyp_double; } |
96 | |
5164 | 97 bool is_real_matrix (void) const { return true; } |
98 | |
99 bool is_real_type (void) const { return true; } | |
100 | |
5895 | 101 bool is_double_type (void) const { return true; } |
102 | |
7576 | 103 bool is_float_type (void) const { return true; } |
104 | |
5164 | 105 double double_value (bool = false) const; |
106 | |
107 double scalar_value (bool frc_str_conv = false) const | |
108 { return double_value (frc_str_conv); } | |
109 | |
110 Matrix matrix_value (bool = false) const; | |
111 | |
112 Complex complex_value (bool = false) const; | |
113 | |
5943 | 114 boolNDArray bool_array_value (bool warn = false) const; |
5898 | 115 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
116 charNDArray char_array_value (bool = false) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
117 |
5164 | 118 ComplexMatrix complex_matrix_value (bool = false) const; |
119 | |
120 ComplexNDArray complex_array_value (bool = false) const; | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
121 |
5164 | 122 NDArray array_value (bool = false) const; |
123 | |
124 SparseMatrix sparse_matrix_value (bool = false) const | |
125 { return matrix; } | |
126 | |
127 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |
128 { return SparseComplexMatrix (matrix); } | |
129 | |
9852
aabf7a8c2e57
implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
130 SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const; |
aabf7a8c2e57
implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
131 |
5322 | 132 octave_value convert_to_str_internal (bool pad, bool force, char type) const; |
5282 | 133 |
5164 | 134 #if 0 |
135 int write (octave_stream& os, int block_size, | |
10313 | 136 oct_data_conv::data_type output_type, int skip, |
137 oct_mach_info::float_format flt_fmt) const | |
5164 | 138 { return os.write (matrix, block_size, output_type, skip, flt_fmt); } |
139 #endif | |
140 | |
141 bool save_binary (std::ostream& os, bool& save_as_floats); | |
142 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
143 bool load_binary (std::istream& is, bool swap, |
10313 | 144 oct_mach_info::float_format fmt); |
5164 | 145 |
146 #if defined (HAVE_HDF5) | |
147 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |
148 | |
9881
b3089dba88bf
Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents:
9852
diff
changeset
|
149 bool load_hdf5 (hid_t loc_id, const char *name); |
5164 | 150 #endif |
151 | |
5900 | 152 mxArray *as_mxArray (void) const; |
153 | |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9685
diff
changeset
|
154 octave_value map (unary_mapper_t umap) const; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
155 |
5164 | 156 private: |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
157 octave_value map (double (*fcn) (double)) const; |
5164 | 158 |
159 DECLARE_OCTAVE_ALLOCATOR | |
160 | |
161 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
162 }; | |
163 | |
164 #endif |