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