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