498
|
1 // oct-obj.h -*- C -*- |
|
2 /* |
|
3 |
1009
|
4 Copyright (C) 1994, 1995 John W. Eaton |
498
|
5 |
|
6 This file is part of Octave. |
|
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 |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
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 |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
498
|
21 |
|
22 */ |
|
23 |
504
|
24 #if !defined (octave_oct_obj_h) |
|
25 #define octave_oct_obj_h 1 |
|
26 |
1297
|
27 #if defined (__GNUG__) |
|
28 #pragma interface |
|
29 #endif |
|
30 |
498
|
31 #include "Array.h" |
526
|
32 #include "mx-base.h" |
498
|
33 |
|
34 class tree_constant; |
526
|
35 class Matrix; |
|
36 class RowVector; |
|
37 class ColumnVector; |
|
38 class DiagMatrix; |
|
39 class ComplexMatrix; |
|
40 class ComplexRowVector; |
|
41 class ComplexColumnVector; |
|
42 class ComplexDiagMatrix; |
|
43 class Range; |
498
|
44 |
737
|
45 class |
|
46 Octave_object : public Array<tree_constant> |
508
|
47 { |
|
48 public: |
|
49 |
|
50 Octave_object (void) : Array<tree_constant> () { } |
511
|
51 Octave_object (int n, const tree_constant& val) |
|
52 : Array<tree_constant> (n, val) { } |
|
53 |
526
|
54 Octave_object (const tree_constant& tc) : Array<tree_constant> (1, tc) { } |
|
55 |
|
56 Octave_object (double d); |
|
57 Octave_object (const Matrix& m); |
|
58 Octave_object (const DiagMatrix& d); |
|
59 Octave_object (const RowVector& v, int pcv = -1); |
|
60 Octave_object (const ColumnVector& v, int pcv = -1); |
|
61 |
|
62 Octave_object (const Complex& c); |
|
63 Octave_object (const ComplexMatrix& m); |
|
64 Octave_object (const ComplexDiagMatrix& d); |
|
65 Octave_object (const ComplexRowVector& v, int pcv = -1); |
|
66 Octave_object (const ComplexColumnVector& v, int pcv = -1); |
|
67 |
|
68 Octave_object (const char *s); |
|
69 |
|
70 Octave_object (double base, double limit, double inc); |
|
71 Octave_object (const Range& r); |
|
72 |
508
|
73 Octave_object (const Octave_object& obj) : Array<tree_constant> (obj) { } |
|
74 |
|
75 Octave_object& operator = (const Octave_object& obj) |
|
76 { |
|
77 Array<tree_constant>::operator = (obj); |
|
78 return *this; |
|
79 } |
|
80 |
526
|
81 // Assignment will resize on range errors. |
508
|
82 |
|
83 tree_constant& operator () (int n); |
526
|
84 |
|
85 tree_constant operator () (int n) const; |
|
86 |
|
87 private: |
508
|
88 |
565
|
89 // This constructor is private with no definition to keep statements |
|
90 // like |
|
91 // |
|
92 // Octave_object foo = 5; |
|
93 // Octave_object foo = 5.0; |
|
94 // |
|
95 // from doing different things. Instead, you have to use the |
|
96 // constructor |
|
97 // |
|
98 // Octave_object (n, val); |
|
99 // |
|
100 // and supply a default value to create a vector-valued Octave_object. |
|
101 |
574
|
102 Octave_object (int n); |
565
|
103 |
526
|
104 void maybe_resize (int n); |
|
105 |
|
106 tree_constant& elem (int n); |
|
107 tree_constant& checkelem (int n); |
|
108 |
508
|
109 tree_constant& xelem (int n); |
|
110 |
|
111 tree_constant elem (int n) const; |
|
112 tree_constant checkelem (int n) const; |
|
113 }; |
498
|
114 |
504
|
115 #endif |
|
116 |
498
|
117 /* |
|
118 ;;; Local Variables: *** |
|
119 ;;; mode: C++ *** |
|
120 ;;; page-delimiter: "^/\\*" *** |
|
121 ;;; End: *** |
|
122 */ |