498
|
1 // oct-obj.h -*- C -*- |
|
2 /* |
|
3 |
526
|
4 Copyright (C) 1994 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 |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
504
|
24 #if !defined (octave_oct_obj_h) |
|
25 #define octave_oct_obj_h 1 |
|
26 |
526
|
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 |
508
|
45 class Octave_object : public Array<tree_constant> |
|
46 { |
|
47 public: |
|
48 |
|
49 Octave_object (void) : Array<tree_constant> () { } |
511
|
50 Octave_object (int n, const tree_constant& val) |
|
51 : Array<tree_constant> (n, val) { } |
|
52 |
526
|
53 Octave_object (const tree_constant& tc) : Array<tree_constant> (1, tc) { } |
|
54 |
|
55 Octave_object (double d); |
|
56 Octave_object (const Matrix& m); |
|
57 Octave_object (const DiagMatrix& d); |
|
58 Octave_object (const RowVector& v, int pcv = -1); |
|
59 Octave_object (const ColumnVector& v, int pcv = -1); |
|
60 |
|
61 Octave_object (const Complex& c); |
|
62 Octave_object (const ComplexMatrix& m); |
|
63 Octave_object (const ComplexDiagMatrix& d); |
|
64 Octave_object (const ComplexRowVector& v, int pcv = -1); |
|
65 Octave_object (const ComplexColumnVector& v, int pcv = -1); |
|
66 |
|
67 Octave_object (const char *s); |
|
68 |
|
69 Octave_object (double base, double limit, double inc); |
|
70 Octave_object (const Range& r); |
|
71 |
508
|
72 Octave_object (const Octave_object& obj) : Array<tree_constant> (obj) { } |
|
73 |
|
74 Octave_object& operator = (const Octave_object& obj) |
|
75 { |
|
76 Array<tree_constant>::operator = (obj); |
|
77 return *this; |
|
78 } |
|
79 |
526
|
80 // Assignment will resize on range errors. |
508
|
81 |
|
82 tree_constant& operator () (int n); |
526
|
83 |
|
84 tree_constant operator () (int n) const; |
|
85 |
|
86 private: |
508
|
87 |
565
|
88 // This constructor is private with no definition to keep statements |
|
89 // like |
|
90 // |
|
91 // Octave_object foo = 5; |
|
92 // Octave_object foo = 5.0; |
|
93 // |
|
94 // from doing different things. Instead, you have to use the |
|
95 // constructor |
|
96 // |
|
97 // Octave_object (n, val); |
|
98 // |
|
99 // and supply a default value to create a vector-valued Octave_object. |
|
100 |
574
|
101 Octave_object (int n); |
565
|
102 |
526
|
103 void maybe_resize (int n); |
|
104 |
|
105 tree_constant& elem (int n); |
|
106 tree_constant& checkelem (int n); |
|
107 |
508
|
108 tree_constant& xelem (int n); |
|
109 |
|
110 tree_constant elem (int n) const; |
|
111 tree_constant checkelem (int n) const; |
|
112 }; |
498
|
113 |
504
|
114 #endif |
|
115 |
498
|
116 /* |
|
117 ;;; Local Variables: *** |
|
118 ;;; mode: C++ *** |
|
119 ;;; page-delimiter: "^/\\*" *** |
|
120 ;;; End: *** |
|
121 */ |