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