comparison liboctave/array/boolMatrix.h @ 19507:25f535b90e52

Change boolMatrix to subclass boolNDArray rather than be another Array<bool>. * boolMatrix.h: both boolMatrix and boolNDArray are Array<bool>, the first being simply 2 dimensional. We change this so that boolMatrix inherits from boolNDArray instead. * boolNDArray.cc, boolNDArray.h (boolNDArray::matrix_value): remove method since boolMatrix can be constructed from its parent. (boolNDArray::boolNDArray): remove constructor from boolMatrix * pr-output.cc, octave-value/ov-bool-mat.cc, octave-value/ov-bool-mat.h: replace calls to boolNDArray::matrix_value () with the boolMatrix constructor.
author Carnë Draug <carandraug@octave.org>
date Mon, 20 Oct 2014 01:34:52 +0100
parents ebb3ef964372
children 8b4a24081e47
comparison
equal deleted inserted replaced
19506:36d1f379a4f0 19507:25f535b90e52
23 23
24 #if !defined (octave_boolMatrix_h) 24 #if !defined (octave_boolMatrix_h)
25 #define octave_boolMatrix_h 1 25 #define octave_boolMatrix_h 1
26 26
27 #include "Array.h" 27 #include "Array.h"
28 #include "boolNDArray.h"
28 29
29 #include "mx-defs.h" 30 #include "mx-defs.h"
30 #include "mx-op-decl.h" 31 #include "mx-op-decl.h"
31 32
32 class 33 class
33 OCTAVE_API 34 OCTAVE_API
34 boolMatrix : public Array<bool> 35 boolMatrix : public boolNDArray
35 { 36 {
36 public: 37 public:
37 38
38 boolMatrix (void) : Array<bool> () { } 39 boolMatrix (void) : boolNDArray () { }
39 40
40 boolMatrix (octave_idx_type r, octave_idx_type c) 41 boolMatrix (octave_idx_type r, octave_idx_type c)
41 : Array<bool> (dim_vector (r, c)) { } 42 : boolNDArray (dim_vector (r, c)) { }
42 43
43 boolMatrix (octave_idx_type r, octave_idx_type c, bool val) 44 boolMatrix (octave_idx_type r, octave_idx_type c, bool val)
44 : Array<bool> (dim_vector (r, c), val) { } 45 : boolNDArray (dim_vector (r, c), val) { }
45 46
46 boolMatrix (const dim_vector& dv) : Array<bool> (dv) { } 47 boolMatrix (const dim_vector& dv) : boolNDArray (dv) { }
47 48
48 boolMatrix (const dim_vector& dv, bool val) : Array<bool> (dv, val) { } 49 boolMatrix (const dim_vector& dv, bool val) : boolNDArray (dv, val) { }
49 50
50 boolMatrix (const Array<bool>& a) : Array<bool> (a.as_matrix ()) { } 51 boolMatrix (const Array<bool>& a) : boolNDArray (a.as_matrix ()) { }
51 52
52 boolMatrix (const boolMatrix& a) : Array<bool> (a) { } 53 boolMatrix (const boolMatrix& a) : boolNDArray (a) { }
53 54
54 boolMatrix& operator = (const boolMatrix& a) 55 boolMatrix& operator = (const boolMatrix& a)
55 { 56 {
56 Array<bool>::operator = (a); 57 Array<bool>::operator = (a);
57 return *this; 58 return *this;