changeset 10351:5150ceb4dbb4

base charMatrix and boolMatrix on Array<char>
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 23 Feb 2010 14:15:34 +0100
parents 12884915a8e4
children a3635bc1ea19
files liboctave/ChangeLog liboctave/boolMatrix.cc liboctave/boolMatrix.h liboctave/chMatrix.cc liboctave/chMatrix.h src/ChangeLog src/ov-bool-mat.h src/ov-ch-mat.h src/ov-str-mat.h
diffstat 9 files changed, 62 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Sat Jan 23 21:41:03 2010 +0100
+++ b/liboctave/ChangeLog	Tue Feb 23 14:15:34 2010 +0100
@@ -1,3 +1,10 @@
+2010-02-23  Jaroslav Hajek  <highegg@gmail.com>
+
+	* chMatrix.h (charMatrix): Base on Array<char>.
+	* chMatrix.cc (charMatrix): Update.
+	* boolMatrix.h (boolMatrix): Ditto.
+	* boolMatrix.h (boolMatrix): Update.
+
 2010-02-23  Jaroslav Hajek  <highegg@gmail.com>
 
 	* Array.h (Array): Define 2D constructors. Remove conflicting 1D
--- a/liboctave/boolMatrix.cc	Sat Jan 23 21:41:03 2010 +0100
+++ b/liboctave/boolMatrix.cc	Tue Feb 23 14:15:34 2010 +0100
@@ -56,7 +56,7 @@
 boolMatrix&
 boolMatrix::insert (const boolMatrix& a, octave_idx_type r, octave_idx_type c)
 {
-  Array2<bool>::insert (a, r, c);
+  Array<bool>::insert (a, r, c);
   return *this;
 }
 
@@ -82,7 +82,7 @@
 boolMatrix
 boolMatrix::diag (octave_idx_type k) const
 {
-  return Array2<bool>::diag (k);
+  return Array<bool>::diag (k);
 }
 
 // FIXME Do these really belong here?  Maybe they should be
--- a/liboctave/boolMatrix.h	Sat Jan 23 21:41:03 2010 +0100
+++ b/liboctave/boolMatrix.h	Tue Feb 23 14:15:34 2010 +0100
@@ -24,35 +24,35 @@
 #if !defined (octave_boolMatrix_int_h)
 #define octave_boolMatrix_int_h 1
 
-#include "Array2.h"
+#include "Array.h"
 
 #include "mx-defs.h"
 #include "mx-op-decl.h"
 
 class
 OCTAVE_API
-boolMatrix : public Array2<bool>
+boolMatrix : public Array<bool>
 {
 public:
 
-  boolMatrix (void) : Array2<bool> () { }
-  boolMatrix (octave_idx_type r, octave_idx_type c) : Array2<bool> (r, c) { }
-  boolMatrix (octave_idx_type r, octave_idx_type c, bool val) : Array2<bool> (r, c, val) { }
-  boolMatrix (const dim_vector& dv) : Array2<bool> (dv) { }
-  boolMatrix (const dim_vector& dv, bool val) : Array2<bool> (dv, val) { }
-  boolMatrix (const Array2<bool>& a) : Array2<bool> (a) { }
-  boolMatrix (const boolMatrix& a) : Array2<bool> (a) { }
+  boolMatrix (void) : Array<bool> () { }
+  boolMatrix (octave_idx_type r, octave_idx_type c) : Array<bool> (r, c) { }
+  boolMatrix (octave_idx_type r, octave_idx_type c, bool val) : Array<bool> (r, c, val) { }
+  boolMatrix (const dim_vector& dv) : Array<bool> (dv) { }
+  boolMatrix (const dim_vector& dv, bool val) : Array<bool> (dv, val) { }
+  boolMatrix (const Array<bool>& a) : Array<bool> (a) { }
+  boolMatrix (const boolMatrix& a) : Array<bool> (a) { }
 
   boolMatrix& operator = (const boolMatrix& a)
     {
-      Array2<bool>::operator = (a);
+      Array<bool>::operator = (a);
       return *this;
     }
 
   bool operator == (const boolMatrix& a) const;
   bool operator != (const boolMatrix& a) const;
 
-  boolMatrix transpose (void) const { return Array2<bool>::transpose (); }
+  boolMatrix transpose (void) const { return Array<bool>::transpose (); }
 
   // destructive insert/delete/reorder operations
 
@@ -80,7 +80,7 @@
 
 private:
 
-  boolMatrix (bool *b, octave_idx_type r, octave_idx_type c) : Array2<bool> (b, r, c) { }
+  boolMatrix (bool *b, octave_idx_type r, octave_idx_type c) : Array<bool> (b, r, c) { }
 };
 
 MM_BOOL_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API)
--- a/liboctave/chMatrix.cc	Sat Jan 23 21:41:03 2010 +0100
+++ b/liboctave/chMatrix.cc	Tue Feb 23 14:15:34 2010 +0100
@@ -40,7 +40,7 @@
 // charMatrix class.
 
 charMatrix::charMatrix (char c)
-  : Array2<char> ()
+  : Array<char> ()
 {
   octave_idx_type nc = 1;
   octave_idx_type nr = 1;
@@ -51,7 +51,7 @@
 }
 
 charMatrix::charMatrix (const char *s)
-  : Array2<char> ()
+  : Array<char> ()
 {
   octave_idx_type nc = s ? strlen (s) : 0;
   octave_idx_type nr = s && nc > 0 ? 1 : 0;
@@ -63,7 +63,7 @@
 }
 
 charMatrix::charMatrix (const std::string& s)
-  : Array2<char> ()
+  : Array<char> ()
 {
   octave_idx_type nc = s.length ();
   octave_idx_type nr = nc > 0 ? 1 : 0;
@@ -75,7 +75,7 @@
 }
 
 charMatrix::charMatrix (const string_vector& s)
-  : Array2<char> (s.length (), s.max_length (), 0)
+  : Array<char> (s.length (), s.max_length (), 0)
 {
   octave_idx_type nr = rows ();
 
@@ -125,7 +125,7 @@
 charMatrix&
 charMatrix::insert (const charMatrix& a, octave_idx_type r, octave_idx_type c)
 {
-  Array2<char>::insert (a, r, c);
+  Array<char>::insert (a, r, c);
   return *this;
 }
 
@@ -196,7 +196,7 @@
 charMatrix
 charMatrix::diag (octave_idx_type k) const
 {
-  return Array2<char>::diag (k);
+  return Array<char>::diag (k);
 }
 
 // FIXME Do these really belong here?  Maybe they should be
--- a/liboctave/chMatrix.h	Sat Jan 23 21:41:03 2010 +0100
+++ b/liboctave/chMatrix.h	Tue Feb 23 14:15:34 2010 +0100
@@ -26,7 +26,7 @@
 
 #include <string>
 
-#include "Array2.h"
+#include "Array.h"
 
 #include "mx-defs.h"
 #include "mx-op-decl.h"
@@ -34,19 +34,19 @@
 
 class
 OCTAVE_API
-charMatrix : public Array2<char>
+charMatrix : public Array<char>
 {
 friend class ComplexMatrix;
 
 public:
 
-  charMatrix (void) : Array2<char> () { }
-  charMatrix (octave_idx_type r, octave_idx_type c) : Array2<char> (r, c) { }
-  charMatrix (octave_idx_type r, octave_idx_type c, char val) : Array2<char> (r, c, val) { }
-  charMatrix (const dim_vector& dv) : Array2<char> (dv) { }
-  charMatrix (const dim_vector& dv, char val) : Array2<char> (dv, val) { }
-  charMatrix (const Array2<char>& a) : Array2<char> (a) { }
-  charMatrix (const charMatrix& a) : Array2<char> (a) { }
+  charMatrix (void) : Array<char> () { }
+  charMatrix (octave_idx_type r, octave_idx_type c) : Array<char> (r, c) { }
+  charMatrix (octave_idx_type r, octave_idx_type c, char val) : Array<char> (r, c, val) { }
+  charMatrix (const dim_vector& dv) : Array<char> (dv) { }
+  charMatrix (const dim_vector& dv, char val) : Array<char> (dv, val) { }
+  charMatrix (const Array<char>& a) : Array<char> (a) { }
+  charMatrix (const charMatrix& a) : Array<char> (a) { }
   charMatrix (char c);
   charMatrix (const char *s);
   charMatrix (const std::string& s);
@@ -54,14 +54,14 @@
 
   charMatrix& operator = (const charMatrix& a)
     {
-      Array2<char>::operator = (a);
+      Array<char>::operator = (a);
       return *this;
     }
 
   bool operator == (const charMatrix& a) const;
   bool operator != (const charMatrix& a) const;
 
-  charMatrix transpose (void) const { return Array2<char>::transpose (); }
+  charMatrix transpose (void) const { return Array<char>::transpose (); }
 
   // destructive insert/delete/reorder operations
 
@@ -90,7 +90,7 @@
 
 private:
 
-  charMatrix (char *ch, octave_idx_type r, octave_idx_type c) : Array2<char> (ch, r, c) { }
+  charMatrix (char *ch, octave_idx_type r, octave_idx_type c) : Array<char> (ch, r, c) { }
 };
 
 MS_CMP_OP_DECLS (charMatrix, char, OCTAVE_API)
--- a/src/ChangeLog	Sat Jan 23 21:41:03 2010 +0100
+++ b/src/ChangeLog	Tue Feb 23 14:15:34 2010 +0100
@@ -1,3 +1,14 @@
+2010-02-23  Jaroslav Hajek  <highegg@gmail.com>
+
+	* ov-bool-mat.h (octave_bool_matrix::octave_bool_matrix (const
+	Array<bool>&)): New ctor.
+	* ov-ch-mat.h (octave_char_matrix::octave_char_matrix (const
+	Array<char>&)): New ctor.
+	* ov-str-mat.h (octave_char_matrix_str::octave_char_matrix_str (const
+	Array<char>&)): New ctor.
+	(octave_char_matrix_sq_str::octave_char_matrix_sq_str (const
+	Array<char>&)): New ctor.
+
 2010-02-23  Jaroslav Hajek  <highegg@gmail.com>
 
 	* Cell.cc: Reflect Array API changes.
--- a/src/ov-bool-mat.h	Sat Jan 23 21:41:03 2010 +0100
+++ b/src/ov-bool-mat.h	Tue Feb 23 14:15:34 2010 +0100
@@ -59,6 +59,9 @@
   octave_bool_matrix (const boolNDArray& bnda)
     : octave_base_matrix<boolNDArray> (bnda) { }
 
+  octave_bool_matrix (const Array<bool>& bnda)
+    : octave_base_matrix<boolNDArray> (bnda) { }
+
   octave_bool_matrix (const boolMatrix& bm)
     : octave_base_matrix<boolNDArray> (bm) { }
 
--- a/src/ov-ch-mat.h	Sat Jan 23 21:41:03 2010 +0100
+++ b/src/ov-ch-mat.h	Tue Feb 23 14:15:34 2010 +0100
@@ -61,6 +61,9 @@
   octave_char_matrix (const charNDArray& chm)
     : octave_base_matrix<charNDArray> (chm) { }
 
+  octave_char_matrix (const Array<char>& chm)
+    : octave_base_matrix<charNDArray> (chm) { }
+
   octave_char_matrix (char c)
     : octave_base_matrix<charNDArray> (c) { }
 
--- a/src/ov-str-mat.h	Sat Jan 23 21:41:03 2010 +0100
+++ b/src/ov-str-mat.h	Tue Feb 23 14:15:34 2010 +0100
@@ -62,6 +62,9 @@
   octave_char_matrix_str (const charNDArray& chm)
     : octave_char_matrix (chm) { }
 
+  octave_char_matrix_str (const Array<char>& chm)
+    : octave_char_matrix (chm) { }
+
   octave_char_matrix_str (char c)
     : octave_char_matrix (c) { }
 
@@ -184,6 +187,9 @@
   octave_char_matrix_sq_str (const charNDArray& chm)
     : octave_char_matrix_str (chm) { }
 
+  octave_char_matrix_sq_str (const Array<char>& chm)
+    : octave_char_matrix_str (chm) { }
+
   octave_char_matrix_sq_str (char c)
     : octave_char_matrix_str (c) { }