2376
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
2376
|
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_complex_h) |
|
24 #define octave_complex_h 1 |
|
25 |
4192
|
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
2376
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 #include <cstdlib> |
|
31 |
3503
|
32 #include <iostream> |
2376
|
33 #include <string> |
|
34 |
|
35 #include "mx-base.h" |
2477
|
36 #include "oct-alloc.h" |
2376
|
37 #include "str-vec.h" |
|
38 |
|
39 #include "error.h" |
|
40 #include "ov-base.h" |
3223
|
41 #include "ov-base-scalar.h" |
2376
|
42 #include "ov-typeinfo.h" |
|
43 |
|
44 class Octave_map; |
|
45 class octave_value_list; |
|
46 |
|
47 class tree_walker; |
|
48 |
2477
|
49 // Complex scalar values. |
2376
|
50 |
|
51 class |
3223
|
52 octave_complex : public octave_base_scalar<Complex> |
2376
|
53 { |
|
54 public: |
|
55 |
|
56 octave_complex (void) |
3223
|
57 : octave_base_scalar<Complex> () { } |
2376
|
58 |
|
59 octave_complex (const Complex& c) |
3223
|
60 : octave_base_scalar<Complex> (c) { } |
2376
|
61 |
|
62 octave_complex (const octave_complex& c) |
3223
|
63 : octave_base_scalar<Complex> (c) { } |
2376
|
64 |
|
65 ~octave_complex (void) { } |
|
66 |
3933
|
67 octave_value *clone (void) const { return new octave_complex (*this); } |
|
68 octave_value *empty_clone (void) const { return new octave_complex (); } |
2376
|
69 |
2410
|
70 octave_value *try_narrowing_conversion (void); |
|
71 |
3933
|
72 octave_value do_index_op (const octave_value_list& idx, int resize_ok); |
2376
|
73 |
|
74 bool is_complex_scalar (void) const { return true; } |
|
75 |
|
76 bool is_complex_type (void) const { return true; } |
|
77 |
|
78 // XXX FIXME XXX ??? |
|
79 bool valid_as_scalar_index (void) const { return false; } |
|
80 bool valid_as_zero_index (void) const { return false; } |
|
81 |
|
82 double double_value (bool = false) const; |
|
83 |
3145
|
84 double scalar_value (bool frc_str_conv = false) const |
|
85 { return double_value (frc_str_conv); } |
2916
|
86 |
2376
|
87 Matrix matrix_value (bool = false) const; |
|
88 |
|
89 Complex complex_value (bool = false) const; |
|
90 |
|
91 ComplexMatrix complex_matrix_value (bool = false) const; |
|
92 |
|
93 void increment (void) { scalar += 1.0; } |
|
94 |
|
95 void decrement (void) { scalar -= 1.0; } |
|
96 |
|
97 private: |
|
98 |
3219
|
99 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2477
|
100 |
3219
|
101 DECLARE_OCTAVE_ALLOCATOR |
2376
|
102 }; |
|
103 |
|
104 #endif |
|
105 |
|
106 /* |
|
107 ;;; Local Variables: *** |
|
108 ;;; mode: C++ *** |
|
109 ;;; End: *** |
|
110 */ |