changeset 10267:479c7df0cc96

don't instantiate MArray<char>
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 04 Feb 2010 14:36:49 +0100
parents 82db36545def
children 9a16a61ed43d
files liboctave/ChangeLog liboctave/MArray-ch.cc liboctave/Makefile.am liboctave/chMatrix.cc liboctave/chMatrix.h liboctave/chNDArray.cc liboctave/chNDArray.h
diffstat 7 files changed, 41 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,12 @@
+2010-02-04  Jaroslav Hajek  <highegg@gmail.com>
+
+	* chMatrix.h (charMatrix): Rebase directly on Array<char>.
+	* chNDArray.h (charNDArray): Ditto.
+	* chMatrix.cc: Update.
+	* chNDArray.cc: Update.
+	* MArray-ch.cc: Remove.
+	* Makefile.am: Update.
+
 2010-02-04  John W. Eaton  <jwe@octave.org>
 
 	* lo-cutils.c (gethostname): Delete function.
deleted file mode 100644
--- a/liboctave/MArray-ch.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-
-Copyright (C) 1995, 1996, 1997, 2000, 2005, 2007 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// Instantiate MArrays of char values.
-
-#include "MArray.h"
-#include "MArray.cc"
-
-template class OCTAVE_API MArray<char>;
-
-INSTANTIATE_MARRAY_FRIENDS (char, OCTAVE_API)
-
-#include "MArray2.h"
-#include "MArray2.cc"
-
-template class OCTAVE_API MArray2<char>;
-
-INSTANTIATE_MARRAY2_FRIENDS (char, OCTAVE_API)
-
-#include "MDiagArray2.h"
-#include "MDiagArray2.cc"
-
-template class OCTAVE_API MDiagArray2<char>;
-
-INSTANTIATE_MDIAGARRAY2_FRIENDS (char, OCTAVE_API)
--- a/liboctave/Makefile.am
+++ b/liboctave/Makefile.am
@@ -296,7 +296,6 @@
   Array-str.cc \
   Array-voidp.cc \
   MArray-C.cc \
-  MArray-ch.cc \
   MArray-d.cc \
   MArray-f.cc \
   MArray-fC.cc \
--- a/liboctave/chMatrix.cc
+++ b/liboctave/chMatrix.cc
@@ -40,7 +40,7 @@
 // charMatrix class.
 
 charMatrix::charMatrix (char c)
-  : MArray2<char> ()
+  : Array2<char> ()
 {
   octave_idx_type nc = 1;
   octave_idx_type nr = 1;
@@ -51,7 +51,7 @@
 }
 
 charMatrix::charMatrix (const char *s)
-  : MArray2<char> ()
+  : Array2<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)
-  : MArray2<char> ()
+  : Array2<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)
-  : MArray2<char> (s.length (), s.max_length (), 0)
+  : Array2<char> (s.length (), s.max_length (), 0)
 {
   octave_idx_type nr = rows ();
 
@@ -196,7 +196,7 @@
 charMatrix
 charMatrix::diag (octave_idx_type k) const
 {
-  return MArray2<char>::diag (k);
+  return Array2<char>::diag (k);
 }
 
 // FIXME Do these really belong here?  Maybe they should be
--- a/liboctave/chMatrix.h
+++ b/liboctave/chMatrix.h
@@ -26,7 +26,7 @@
 
 #include <string>
 
-#include "MArray2.h"
+#include "Array2.h"
 
 #include "mx-defs.h"
 #include "mx-op-decl.h"
@@ -34,19 +34,19 @@
 
 class
 OCTAVE_API
-charMatrix : public MArray2<char>
+charMatrix : public Array2<char>
 {
 friend class ComplexMatrix;
 
 public:
 
-  charMatrix (void) : MArray2<char> () { }
-  charMatrix (octave_idx_type r, octave_idx_type c) : MArray2<char> (r, c) { }
-  charMatrix (octave_idx_type r, octave_idx_type c, char val) : MArray2<char> (r, c, val) { }
-  charMatrix (const dim_vector& dv) : MArray2<char> (dv) { }
-  charMatrix (const dim_vector& dv, char val) : MArray2<char> (dv, val) { }
-  charMatrix (const MArray2<char>& a) : MArray2<char> (a) { }
-  charMatrix (const charMatrix& a) : MArray2<char> (a) { }
+  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 (char c);
   charMatrix (const char *s);
   charMatrix (const std::string& s);
@@ -54,14 +54,14 @@
 
   charMatrix& operator = (const charMatrix& a)
     {
-      MArray2<char>::operator = (a);
+      Array2<char>::operator = (a);
       return *this;
     }
 
   bool operator == (const charMatrix& a) const;
   bool operator != (const charMatrix& a) const;
 
-  charMatrix transpose (void) const { return MArray2<char>::transpose (); }
+  charMatrix transpose (void) const { return Array2<char>::transpose (); }
 
   // destructive insert/delete/reorder operations
 
@@ -90,7 +90,7 @@
 
 private:
 
-  charMatrix (char *ch, octave_idx_type r, octave_idx_type c) : MArray2<char> (ch, r, c) { }
+  charMatrix (char *ch, octave_idx_type r, octave_idx_type c) : Array2<char> (ch, r, c) { }
 };
 
 MS_CMP_OP_DECLS (charMatrix, char, OCTAVE_API)
@@ -102,6 +102,4 @@
 MM_CMP_OP_DECLS (charMatrix, charMatrix, OCTAVE_API)
 MM_BOOL_OP_DECLS (charMatrix, charMatrix, OCTAVE_API)
 
-MARRAY_FORWARD_DEFS (MArray2, charMatrix, char)
-
 #endif
--- a/liboctave/chNDArray.cc
+++ b/liboctave/chNDArray.cc
@@ -151,7 +151,7 @@
 charNDArray
 charNDArray::diag (octave_idx_type k) const
 {
-  return MArrayN<char>::diag (k);
+  return Array<char>::diag (k);
 }
 
 NDS_CMP_OPS (charNDArray, char)
--- a/liboctave/chNDArray.h
+++ b/liboctave/chNDArray.h
@@ -23,7 +23,7 @@
 #if !defined (octave_charNDArray_h)
 #define octave_charNDArray_h 1
 
-#include "MArrayN.h"
+#include "Array.h"
 #include "chMatrix.h"
 
 #include "mx-defs.h"
@@ -32,35 +32,35 @@
 
 class
 OCTAVE_API
-charNDArray : public MArrayN<char>
+charNDArray : public Array<char>
 {
 public:
 
   typedef charMatrix matrix_type;
 
-  charNDArray (void) : MArrayN<char> () { }
+  charNDArray (void) : Array<char> () { }
 
-  charNDArray (const dim_vector& dv) : MArrayN<char> (dv) { }
+  charNDArray (const dim_vector& dv) : Array<char> (dv) { }
 
-  charNDArray (const dim_vector& dv, char val) : MArrayN<char> (dv, val) { }
+  charNDArray (const dim_vector& dv, char val) : Array<char> (dv, val) { }
   
-  charNDArray (const charNDArray& a) : MArrayN<char> (a) { }
+  charNDArray (const charNDArray& a) : Array<char> (a) { }
 
-  charNDArray (const charMatrix& a) : MArrayN<char> (a) { }
+  charNDArray (const charMatrix& a) : Array<char> (a) { }
 
-  charNDArray (char c) : MArrayN<char> (charMatrix (c)) { }
+  charNDArray (char c) : Array<char> (charMatrix (c)) { }
 
-  charNDArray (const char *s) : MArrayN<char> (charMatrix (s)) { }
+  charNDArray (const char *s) : Array<char> (charMatrix (s)) { }
 
-  charNDArray (const std::string& s) : MArrayN<char> (charMatrix (s)) { }
+  charNDArray (const std::string& s) : Array<char> (charMatrix (s)) { }
 
-  charNDArray (const string_vector& s) : MArrayN<char> (charMatrix (s)) { }
+  charNDArray (const string_vector& s) : Array<char> (charMatrix (s)) { }
 
-  charNDArray (const Array<char>& a) : MArrayN<char> (a) { }
+  charNDArray (const Array<char>& a) : Array<char> (a) { }
 
   charNDArray& operator = (const charNDArray& a)
     {
-      MArrayN<char>::operator = (a);
+      Array<char>::operator = (a);
       return *this;
     }
 
@@ -98,7 +98,7 @@
 
 private:
 
-  charNDArray (char *d, dim_vector& dv) : MArrayN<char> (d, dv) { }
+  charNDArray (char *d, dim_vector& dv) : Array<char> (d, dv) { }
 };
 
 NDS_CMP_OP_DECLS (charNDArray, char, OCTAVE_API)
@@ -110,8 +110,6 @@
 NDND_CMP_OP_DECLS (charNDArray, charNDArray, OCTAVE_API)
 NDND_BOOL_OP_DECLS (charNDArray, charNDArray, OCTAVE_API)
 
-MARRAY_FORWARD_DEFS (MArrayN, charNDArray, char)
-
 BSXFUN_STDREL_DECLS (charNDArray, OCTAVE_API)
 
 #endif