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