3665
|
1 /* |
|
2 |
|
3 Copyright (C) 2000 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 2, or (at your option) any |
|
10 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, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_base_nd_array_h) |
|
24 #define octave_base_nd_array_h 1 |
|
25 |
4192
|
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
3665
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 #include <cstdlib> |
|
31 |
|
32 #include <iostream> |
|
33 #include <string> |
|
34 |
|
35 #include "mx-base.h" |
|
36 #include "str-vec.h" |
|
37 |
|
38 #include "error.h" |
|
39 #include "ov-base.h" |
|
40 #include "ov-typeinfo.h" |
|
41 |
|
42 class Octave_map; |
|
43 class octave_value_list; |
|
44 |
|
45 class tree_walker; |
|
46 |
|
47 // ND array values values. |
|
48 |
|
49 template <class AT> |
|
50 class |
|
51 octave_base_nd_array : public octave_base_value |
|
52 { |
|
53 public: |
|
54 |
|
55 octave_base_nd_array (void) |
|
56 : octave_base_value () { } |
|
57 |
|
58 octave_base_nd_array (const AT& a) |
|
59 : octave_base_value (), array (a) { } |
|
60 |
|
61 octave_base_nd_array (const octave_base_nd_array& a) |
|
62 : octave_base_value (), array (a.array) { } |
|
63 |
|
64 ~octave_base_nd_array (void) { } |
|
65 |
3933
|
66 octave_value *clone (void) const { return new octave_base_nd_array (*this); } |
|
67 octave_value *empty_clone (void) const { return new octave_base_nd_array (); } |
3665
|
68 |
3933
|
69 octave_value do_index_op (const octave_value_list& idx, int resize_ok); |
3665
|
70 |
|
71 bool is_matrix_type (void) const { return false; } |
|
72 |
|
73 bool is_numeric_type (void) const { return true; } |
|
74 |
|
75 bool is_defined (void) const { return true; } |
|
76 |
|
77 bool is_constant (void) const { return true; } |
|
78 |
|
79 bool is_true (void) const; |
|
80 |
|
81 virtual bool print_as_scalar (void) const; |
|
82 |
|
83 void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
84 |
|
85 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
86 |
|
87 bool print_name_tag (std::ostream& os, const std::string& name) const; |
|
88 |
|
89 protected: |
|
90 |
|
91 AT array; |
|
92 }; |
|
93 |
|
94 #endif |
|
95 |
|
96 /* |
|
97 ;;; Local Variables: *** |
|
98 ;;; mode: C++ *** |
|
99 ;;; End: *** |
|
100 */ |