annotate liboctave/so-array.h @ 4665:dece11da64ed ss-2-1-52

[project @ 2003-11-25 15:37:32 by jwe]
author jwe
date Tue, 25 Nov 2003 15:37:32 +0000
parents c8829691db47
children e35b034d3523
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4647
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
1 /*
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
2
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
3 Copyright (C) 2003 John W. Eaton
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
4
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
6
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
10 later version.
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
11
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
15 for more details.
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
16
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, write to the Free
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
20
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
21 */
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
22
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
23 #if !defined (octave_streamoff_array_h)
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
24 #define octave_streamoff_array_h 1
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
25
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
27 #pragma interface
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
28 #endif
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
29
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
30 #include <iostream>
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
31
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
32 #include "ArrayN.h"
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
33 #include "mx-op-defs.h"
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
34
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
35 class boolNDArray;
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
36
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
37 // Stream offsets.
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
38
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
39 class streamoff_array : public ArrayN<std::streamoff>
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
40 {
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
41 public:
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
42
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
43 streamoff_array (void) : ArrayN<std::streamoff> () { }
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
44
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
45 streamoff_array (const dim_vector& dv,
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
46 const std::streamoff& val = resize_fill_value ())
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
47 : ArrayN<std::streamoff> (dv, val) { }
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
48
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
49 streamoff_array (const ArrayN<std::streamoff>& sa)
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
50 : ArrayN<std::streamoff> (sa) { }
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
51
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
52 streamoff_array (const streamoff_array& sa)
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
53 : ArrayN<std::streamoff> (sa) { }
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
54
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
55 ~streamoff_array (void) { }
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
56
4655
c8829691db47 [project @ 2003-11-24 21:24:37 by jwe]
jwe
parents: 4647
diff changeset
57 streamoff_array& operator = (const streamoff_array& sa)
4647
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
58 {
4655
c8829691db47 [project @ 2003-11-24 21:24:37 by jwe]
jwe
parents: 4647
diff changeset
59 if (this != &sa)
c8829691db47 [project @ 2003-11-24 21:24:37 by jwe]
jwe
parents: 4647
diff changeset
60 ArrayN<std::streamoff>::operator = (sa);
4647
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
61
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
62 return *this;
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
63 }
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
64
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
65 streamoff_array squeeze (void) const
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
66 { return ArrayN<std::streamoff>::squeeze (); }
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
67
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
68 boolNDArray all (int dim = -1) const;
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
69 boolNDArray any (int dim = -1) const;
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
70
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
71 static int compute_index (Array<int>& ra_idx,
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
72 const dim_vector& dimensions);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
73
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
74 static std::streamoff resize_fill_value (void) { return 0; }
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
75 };
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
76
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
77 streamoff_array& operator += (streamoff_array& l, const std::streamoff& r);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
78 streamoff_array& operator -= (streamoff_array& l, const std::streamoff& r);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
79
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
80 streamoff_array& operator += (streamoff_array& l, const streamoff_array& r);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
81 streamoff_array& operator -= (streamoff_array& l, const streamoff_array& r);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
82
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
83 NDCMP_OP_DECL (mx_el_eq, std::streamoff, streamoff_array);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
84 NDCMP_OP_DECL (mx_el_ne, std::streamoff, streamoff_array);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
85
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
86 NDCMP_OP_DECL (mx_el_eq, streamoff_array, std::streamoff);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
87 NDCMP_OP_DECL (mx_el_ne, streamoff_array, std::streamoff);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
88
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
89 NDCMP_OP_DECL (mx_el_eq, streamoff_array, streamoff_array);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
90 NDCMP_OP_DECL (mx_el_ne, streamoff_array, streamoff_array);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
91
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
92 BIN_OP_DECL (streamoff_array, operator +, streamoff_array, streamoff_array);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
93 BIN_OP_DECL (streamoff_array, operator -, streamoff_array, streamoff_array);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
94
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
95 BIN_OP_DECL (streamoff_array, operator +, streamoff_array, std::streamoff);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
96 BIN_OP_DECL (streamoff_array, operator -, streamoff_array, std::streamoff);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
97
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
98 BIN_OP_DECL (streamoff_array, operator +, std::streamoff, streamoff_array);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
99 BIN_OP_DECL (streamoff_array, operator -, std::streamoff, streamoff_array);
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
100
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
101 #endif
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
102
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
103 /*
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
104 ;;; Local Variables: ***
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
105 ;;; mode: C++ ***
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
106 ;;; End: ***
6d26997e1fc3 [project @ 2003-11-23 18:18:58 by jwe]
jwe
parents:
diff changeset
107 */