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 #include "data-conv.h" |
|
37 #include "mach-info.h" |
|
38 |
|
39 class |
|
40 charNDArray : public MArrayN<char> |
|
41 { |
|
42 public: |
|
43 |
|
44 charNDArray (void) : MArrayN<char> () { } |
|
45 |
4587
|
46 charNDArray (dim_vector& dv) : MArrayN<char> (dv) { } |
4514
|
47 |
4587
|
48 charNDArray (dim_vector& dv, char val) : MArrayN<char> (dv, val) { } |
4514
|
49 |
|
50 charNDArray (const charNDArray& a) : MArrayN<char> (a) { } |
|
51 |
|
52 charNDArray (const charMatrix& a) : MArrayN<char> (a) { } |
|
53 |
|
54 charNDArray (char c) : MArrayN<char> (charMatrix (c)) { } |
|
55 |
|
56 charNDArray (const char *s) : MArrayN<char> (charMatrix (s)) { } |
|
57 |
|
58 charNDArray (const std::string& s) : MArrayN<char> (charMatrix (s)) { } |
|
59 |
|
60 charNDArray (const string_vector& s) : MArrayN<char> (charMatrix (s)) { } |
|
61 |
|
62 charNDArray (const ArrayN<char>& a) : MArrayN<char> (a) { } |
|
63 |
|
64 charNDArray& operator = (const charNDArray& a) |
|
65 { |
|
66 MArrayN<char>::operator = (a); |
|
67 return *this; |
|
68 } |
|
69 |
|
70 // XXX FIXME XXX -- this is not quite the right thing. |
|
71 |
4556
|
72 boolNDArray all (int dim = -1) const; |
|
73 boolNDArray any (int dim = -1) const; |
4758
|
74 bool cat (charNDArray& cat_array, int dim, int add_dim) const; |
|
75 |
4514
|
76 charMatrix matrix_value (void) const; |
|
77 |
4532
|
78 charNDArray squeeze (void) const { return ArrayN<char>::squeeze (); } |
|
79 |
|
80 static void increment_index (Array<int>& ra_idx, |
|
81 const dim_vector& dimensions, |
|
82 int start_dimension = 0); |
|
83 |
4556
|
84 static int compute_index (Array<int>& ra_idx, |
|
85 const dim_vector& dimensions); |
|
86 |
4514
|
87 // i/o |
|
88 |
|
89 // friend std::ostream& operator << (std::ostream& os, const charNDArray& a); |
|
90 // friend std::istream& operator >> (std::istream& is, charNDArray& a); |
|
91 |
|
92 static char resize_fill_value (void) { return '\0'; } |
|
93 |
|
94 private: |
|
95 |
4587
|
96 charNDArray (char *d, dim_vector& dv) : MArrayN<char> (d, dv) { } |
4514
|
97 }; |
|
98 |
|
99 MARRAY_FORWARD_DEFS (MArrayN, charNDArray, char) |
|
100 |
|
101 #endif |
|
102 |
|
103 /* |
|
104 ;;; Local Variables: *** |
|
105 ;;; mode: C++ *** |
|
106 ;;; End: *** |
|
107 */ |