4514
|
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 (octave_charNDArray_h) |
|
24 #define octave_charNDArray_h 1 |
|
25 |
|
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 #include "MArrayN.h" |
|
31 #include "chMatrix.h" |
|
32 |
|
33 #include "mx-defs.h" |
|
34 #include "mx-op-defs.h" |
|
35 |
|
36 class |
|
37 charNDArray : public MArrayN<char> |
|
38 { |
|
39 public: |
|
40 |
|
41 charNDArray (void) : MArrayN<char> () { } |
|
42 |
4587
|
43 charNDArray (dim_vector& dv) : MArrayN<char> (dv) { } |
4514
|
44 |
4587
|
45 charNDArray (dim_vector& dv, char val) : MArrayN<char> (dv, val) { } |
4514
|
46 |
|
47 charNDArray (const charNDArray& a) : MArrayN<char> (a) { } |
|
48 |
|
49 charNDArray (const charMatrix& a) : MArrayN<char> (a) { } |
|
50 |
|
51 charNDArray (char c) : MArrayN<char> (charMatrix (c)) { } |
|
52 |
|
53 charNDArray (const char *s) : MArrayN<char> (charMatrix (s)) { } |
|
54 |
|
55 charNDArray (const std::string& s) : MArrayN<char> (charMatrix (s)) { } |
|
56 |
|
57 charNDArray (const string_vector& s) : MArrayN<char> (charMatrix (s)) { } |
|
58 |
|
59 charNDArray (const ArrayN<char>& a) : MArrayN<char> (a) { } |
|
60 |
|
61 charNDArray& operator = (const charNDArray& a) |
|
62 { |
|
63 MArrayN<char>::operator = (a); |
|
64 return *this; |
|
65 } |
|
66 |
|
67 // XXX FIXME XXX -- this is not quite the right thing. |
|
68 |
4556
|
69 boolNDArray all (int dim = -1) const; |
|
70 boolNDArray any (int dim = -1) const; |
4915
|
71 friend charNDArray concat (const charNDArray& ra, const charNDArray& rb, |
|
72 const Array<int>& ra_idx); |
|
73 friend charNDArray concat (const charNDArray& ra, const NDArray& rb, |
|
74 const Array<int>& ra_idx); |
|
75 friend charNDArray concat (const NDArray& ra, const charNDArray& rb, |
|
76 const Array<int>& ra_idx); |
|
77 |
|
78 charNDArray& insert (const charNDArray& a, int r, int c); |
|
79 charNDArray& insert (const charNDArray& a, const Array<int>& ra_idx); |
|
80 |
4514
|
81 charMatrix matrix_value (void) const; |
|
82 |
4532
|
83 charNDArray squeeze (void) const { return ArrayN<char>::squeeze (); } |
|
84 |
|
85 static void increment_index (Array<int>& ra_idx, |
|
86 const dim_vector& dimensions, |
|
87 int start_dimension = 0); |
|
88 |
4556
|
89 static int compute_index (Array<int>& ra_idx, |
|
90 const dim_vector& dimensions); |
|
91 |
4514
|
92 // i/o |
|
93 |
|
94 // friend std::ostream& operator << (std::ostream& os, const charNDArray& a); |
|
95 // friend std::istream& operator >> (std::istream& is, charNDArray& a); |
|
96 |
|
97 static char resize_fill_value (void) { return '\0'; } |
|
98 |
|
99 private: |
|
100 |
4587
|
101 charNDArray (char *d, dim_vector& dv) : MArrayN<char> (d, dv) { } |
4514
|
102 }; |
|
103 |
|
104 MARRAY_FORWARD_DEFS (MArrayN, charNDArray, char) |
|
105 |
|
106 #endif |
|
107 |
|
108 /* |
|
109 ;;; Local Variables: *** |
|
110 ;;; mode: C++ *** |
|
111 ;;; End: *** |
|
112 */ |