comparison liboctave/MArray.h @ 3573:6ae6f1180e62

[project @ 2000-02-04 09:01:59 by jwe]
author jwe
date Fri, 04 Feb 2000 09:02:04 +0000
parents 5eef8a2294bd
children d9803711e047
comparison
equal deleted inserted replaced
3572:8d641545e006 3573:6ae6f1180e62
28 #if !defined (octave_MArray_h) 28 #if !defined (octave_MArray_h)
29 #define octave_MArray_h 1 29 #define octave_MArray_h 1
30 30
31 #include "Array.h" 31 #include "Array.h"
32 32
33 #if defined (LTGT) 33 // One dimensional array with math ops.
34 #undef LTGT
35 #endif
36 34
37 #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) 35 // But first, some preprocessor abuse...
38 #define LTGT
39 #else
40 36
41 #define LTGT <> 37 #include "MArray-defs.h"
42 38
43 template <class T> 39 MARRAY_OPS_FORWARD_DECLS (MArray)
44 class MArray;
45
46 template <typename T> MArray<T>&
47 operator += (MArray<T>& a, const T& s);
48
49 template <typename T> MArray<T>&
50 operator -= (MArray<T>& a, const T& s);
51
52 template <typename T> MArray<T>&
53 operator += (MArray<T>& a, const MArray<T>& b);
54
55 template <typename T> MArray<T>&
56 operator -= (MArray<T>& a, const MArray<T>& b);
57
58 template <typename T> MArray<T>
59 operator + (const MArray<T>& a, const T& s);
60
61 template <typename T> MArray<T>
62 operator - (const MArray<T>& a, const T& s);
63
64 template <typename T> MArray<T>
65 operator * (const MArray<T>& a, const T& s);
66
67 template <typename T> MArray<T>
68 operator / (const MArray<T>& a, const T& s);
69
70 template <typename T> MArray<T>
71 operator + (const T& s, const MArray<T>& a);
72
73 template <typename T> MArray<T>
74 operator - (const T& s, const MArray<T>& a);
75
76 template <typename T> MArray<T>
77 operator * (const T& s, const MArray<T>& a);
78
79 template <typename T> MArray<T>
80 operator / (const T& s, const MArray<T>& a);
81
82 template <typename T> MArray<T>
83 operator + (const MArray<T>& a, const MArray<T>& b);
84
85 template <typename T> MArray<T>
86 operator - (const MArray<T>& a, const MArray<T>& b);
87
88 template <class T> MArray<T>
89 product (const MArray<T>& a, const MArray<T>& b);
90
91 template <typename T> MArray<T>
92 quotient (const MArray<T>& a, const MArray<T>& b);
93
94 template <typename T> MArray<T>
95 operator - (const MArray<T>& a);
96 #endif
97
98 // One dimensional array with math ops.
99 40
100 template <class T> 41 template <class T>
101 class MArray : public Array<T> 42 class MArray : public Array<T>
102 { 43 {
103 protected: 44 protected:
117 MArray<T>& operator = (const MArray<T>& a) 58 MArray<T>& operator = (const MArray<T>& a)
118 { 59 {
119 Array<T>::operator = (a); 60 Array<T>::operator = (a);
120 return *this; 61 return *this;
121 } 62 }
63
64 // Currently, the OPS functions don't need to be friends, but that
65 // may change.
66
67 MARRAY_OPS_FRIEND_DECLS (MArray)
122 }; 68 };
123 69
124 #undef LTGT 70 // XXX FIXME XXX -- there must be a better place for this...
125
126 extern void 71 extern void
127 gripe_nonconformant (const char *op, int op1_len, int op2_len); 72 gripe_nonconformant (const char *op, int op1_len, int op2_len);
128
129 #define INSTANTIATE_MARRAY_FRIENDS(T) \
130 template MArray<T>& operator += (MArray<T>& a, const T& s); \
131 template MArray<T>& operator -= (MArray<T>& a, const T& s); \
132 template MArray<T>& operator += (MArray<T>& a, const MArray<T>& b); \
133 template MArray<T>& operator -= (MArray<T>& a, const MArray<T>& b); \
134 template MArray<T> operator + (const MArray<T>& a, const T& s); \
135 template MArray<T> operator - (const MArray<T>& a, const T& s); \
136 template MArray<T> operator * (const MArray<T>& a, const T& s); \
137 template MArray<T> operator / (const MArray<T>& a, const T& s); \
138 template MArray<T> operator + (const T& s, const MArray<T>& a); \
139 template MArray<T> operator - (const T& s, const MArray<T>& a); \
140 template MArray<T> operator * (const T& s, const MArray<T>& a); \
141 template MArray<T> operator / (const T& s, const MArray<T>& a); \
142 template MArray<T> operator + (const MArray<T>& a, const MArray<T>& b); \
143 template MArray<T> operator - (const MArray<T>& a, const MArray<T>& b); \
144 template MArray<T> product (const MArray<T>& a, const MArray<T>& b); \
145 template MArray<T> quotient (const MArray<T>& a, const MArray<T>& b); \
146 template MArray<T> operator - (const MArray<T>& a);
147 73
148 #endif 74 #endif
149 75
150 /* 76 /*
151 ;;; Local Variables: *** 77 ;;; Local Variables: ***