1993
|
1 // Template array classes with like-type math ops |
237
|
2 /* |
|
3 |
2847
|
4 Copyright (C) 1996, 1997 John W. Eaton |
237
|
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. |
237
|
21 |
|
22 */ |
|
23 |
4061
|
24 #if defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
1296
|
25 #pragma interface |
|
26 #endif |
|
27 |
382
|
28 #if !defined (octave_MArray_h) |
|
29 #define octave_MArray_h 1 |
|
30 |
237
|
31 #include "Array.h" |
|
32 |
3573
|
33 // One dimensional array with math ops. |
3107
|
34 |
3573
|
35 // But first, some preprocessor abuse... |
3107
|
36 |
3573
|
37 #include "MArray-defs.h" |
3107
|
38 |
3573
|
39 MARRAY_OPS_FORWARD_DECLS (MArray) |
237
|
40 |
|
41 template <class T> |
3585
|
42 class |
|
43 MArray : public Array<T> |
237
|
44 { |
|
45 protected: |
|
46 |
|
47 MArray (T *d, int l) : Array<T> (d, l) { } |
|
48 |
|
49 public: |
|
50 |
|
51 MArray (void) : Array<T> () { } |
3585
|
52 |
|
53 explicit MArray (int n) : Array<T> (n) { } |
|
54 |
237
|
55 MArray (int n, const T& val) : Array<T> (n, val) { } |
3585
|
56 |
|
57 MArray (const MArray<T>& a) : Array<T> (a) { } |
|
58 |
3419
|
59 MArray (const Array<T>& a) : Array<T> (a) { } |
237
|
60 |
1230
|
61 ~MArray (void) { } |
|
62 |
237
|
63 MArray<T>& operator = (const MArray<T>& a) |
1213
|
64 { |
|
65 Array<T>::operator = (a); |
|
66 return *this; |
|
67 } |
3573
|
68 |
|
69 // Currently, the OPS functions don't need to be friends, but that |
|
70 // may change. |
|
71 |
3610
|
72 // MARRAY_OPS_FRIEND_DECLS (MArray) |
237
|
73 }; |
|
74 |
3573
|
75 // XXX FIXME XXX -- there must be a better place for this... |
2391
|
76 extern void |
|
77 gripe_nonconformant (const char *op, int op1_len, int op2_len); |
|
78 |
237
|
79 #endif |
|
80 |
|
81 /* |
|
82 ;;; Local Variables: *** |
|
83 ;;; mode: C++ *** |
|
84 ;;; End: *** |
|
85 */ |