4647
|
1 /* |
|
2 |
|
3 Copyright (C) 2003 John W. Eaton |
|
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 (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
|
31 #include <iostream> |
|
32 |
|
33 #include "ArrayN.h" |
4648
|
34 #include "Array-util.h" |
4647
|
35 // XXX FIXME XXX -- we are including the MArray{,2,N}.h files just for |
|
36 // their gripe_nonconformant function decls. |
|
37 #include "MArray.h" |
|
38 #include "MArray2.h" |
|
39 #include "MArrayN.h" |
|
40 #include "MArray-defs.h" |
|
41 #include "boolMatrix.h" |
|
42 #include "boolNDArray.h" |
|
43 #include "mx-op-defs.h" |
|
44 #include "so-array.h" |
|
45 |
|
46 boolNDArray |
|
47 streamoff_array::all (int dim) const |
|
48 { |
|
49 MX_ND_ANY_ALL_REDUCTION (MX_ND_ALL_EVAL (MX_ND_ALL_EXPR), true); |
|
50 } |
|
51 |
|
52 boolNDArray |
|
53 streamoff_array::any (int dim) const |
|
54 { |
|
55 MX_ND_ANY_ALL_REDUCTION (MX_ND_ANY_EVAL (MX_ND_ANY_EXPR), false); |
|
56 } |
|
57 |
|
58 streamoff_array& |
|
59 operator += (streamoff_array& a, const std::streamoff& s) |
|
60 { |
|
61 DO_VS_OP2 (std::streamoff, a, +=, s) |
|
62 return a; |
|
63 } |
|
64 |
|
65 streamoff_array& |
|
66 operator -= (streamoff_array& a, const std::streamoff& s) |
|
67 { |
|
68 DO_VS_OP2 (std::streamoff, a, -=, s); |
|
69 return a; |
|
70 } |
|
71 |
|
72 streamoff_array& |
|
73 operator += (streamoff_array& a, const streamoff_array& b) |
|
74 { |
|
75 int l = a.length (); |
|
76 if (l > 0) |
|
77 { |
|
78 int bl = b.length (); |
|
79 if (l != bl) |
|
80 gripe_nonconformant ("operator +=", l, bl); |
|
81 else |
|
82 DO_VV_OP2 (std::streamoff, a, +=, b); |
|
83 } |
|
84 return a; |
|
85 } |
|
86 |
|
87 streamoff_array& |
|
88 operator -= (streamoff_array& a, const streamoff_array& b) |
|
89 { |
|
90 int l = a.length (); |
|
91 if (l > 0) |
|
92 { |
|
93 int bl = b.length (); |
|
94 if (l != bl) |
|
95 gripe_nonconformant ("operator -=", l, bl); |
|
96 else |
|
97 DO_VV_OP2 (std::streamoff, a, -=, b); |
|
98 } |
|
99 return a; |
|
100 } |
|
101 |
|
102 int |
|
103 streamoff_array::compute_index (Array<int>& ra_idx, |
|
104 const dim_vector& dimensions) |
|
105 { |
|
106 return ::compute_index (ra_idx, dimensions); |
|
107 } |
|
108 |
4835
|
109 SND_CMP_OP (mx_el_eq, ==, std::streamoff, , streamoff_array, ) |
|
110 SND_CMP_OP (mx_el_ne, !=, std::streamoff, , streamoff_array, ) |
4647
|
111 |
4835
|
112 NDS_CMP_OP (mx_el_eq, ==, streamoff_array, , std::streamoff, ) |
|
113 NDS_CMP_OP (mx_el_ne, !=, streamoff_array, , std::streamoff, ) |
4647
|
114 |
4835
|
115 NDND_CMP_OP (mx_el_eq, ==, streamoff_array, , streamoff_array, ) |
|
116 NDND_CMP_OP (mx_el_ne, !=, streamoff_array, , streamoff_array, ) |
4647
|
117 |
|
118 NDND_BIN_OP (streamoff_array, operator +, |
|
119 streamoff_array, streamoff_array, mx_inline_add) |
|
120 |
|
121 NDND_BIN_OP (streamoff_array, operator -, |
|
122 streamoff_array, streamoff_array, mx_inline_subtract) |
|
123 |
|
124 |
|
125 NDS_BIN_OP (streamoff_array, operator +, |
|
126 streamoff_array, std::streamoff, mx_inline_add) |
|
127 |
|
128 NDS_BIN_OP (streamoff_array, operator -, |
|
129 streamoff_array, std::streamoff, mx_inline_subtract) |
|
130 |
|
131 |
|
132 SND_BIN_OP (streamoff_array, operator +, |
|
133 std::streamoff, streamoff_array, mx_inline_add) |
|
134 |
|
135 SND_BIN_OP (streamoff_array, operator -, |
|
136 std::streamoff, streamoff_array, mx_inline_subtract) |
|
137 |
|
138 /* |
|
139 ;;; Local Variables: *** |
|
140 ;;; mode: C++ *** |
|
141 ;;; End: *** |
|
142 */ |