toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] TooN TooN.h linoperators.hh maccessor.hh mbase....


From: Gerhard Reitmayr
Subject: [Toon-members] TooN TooN.h linoperators.hh maccessor.hh mbase....
Date: Wed, 12 Dec 2007 15:59:43 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Gerhard Reitmayr <gerhard>      07/12/12 15:59:43

Modified files:
        .              : TooN.h linoperators.hh maccessor.hh mbase.hh 
                         mclasses.hh membase.hh vaccessor.hh vbase.hh 
                         vclasses.hh 

Log message:
        small cleanups to make TooN work with Visual Studio 2005

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/TooN.h?cvsroot=toon&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/TooN/linoperators.hh?cvsroot=toon&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/TooN/maccessor.hh?cvsroot=toon&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/TooN/mbase.hh?cvsroot=toon&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/TooN/mclasses.hh?cvsroot=toon&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/TooN/membase.hh?cvsroot=toon&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/TooN/vaccessor.hh?cvsroot=toon&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/TooN/vbase.hh?cvsroot=toon&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/TooN/vclasses.hh?cvsroot=toon&r1=1.24&r2=1.25

Patches:
Index: TooN.h
===================================================================
RCS file: /cvsroot/toon/TooN/TooN.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- TooN.h      17 Jul 2006 14:15:50 -0000      1.9
+++ TooN.h      12 Dec 2007 15:59:43 -0000      1.10
@@ -20,6 +20,9 @@
 #ifndef __TOON_H
 #define __TOON_H
 
+#ifdef WIN32 // to get M_PI, etc.
+#define _USE_MATH_DEFINES   
+#endif
 
 #include <string.h>  // for memcpy
 #include <cmath>    // for sqrt
@@ -130,10 +133,10 @@
 class MatrixBase;
 
 template<int Rows, int Cols, class Accessor>
-struct FixedMatrix;
+class FixedMatrix;
 
 template<class Accessor>
-struct DynamicMatrix;
+class DynamicMatrix;
 
 template<class Layout>
 class RefMatrix;

Index: linoperators.hh
===================================================================
RCS file: /cvsroot/toon/TooN/linoperators.hh,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- linoperators.hh     17 Oct 2007 00:13:07 -0000      1.18
+++ linoperators.hh     12 Dec 2007 15:59:43 -0000      1.19
@@ -20,9 +20,6 @@
 #ifndef __LINOPERATORS_HH
 #define __LINOPERATORS_HH
 
-#include <assert.h>
-
-
 inline RefMatrixRM DynamicVAccessor::as_row(){
   return makeRefMatrixRM(1,my_size,my_values);
 }

Index: maccessor.hh
===================================================================
RCS file: /cvsroot/toon/TooN/maccessor.hh,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- maccessor.hh        15 Jan 2007 18:19:34 -0000      1.10
+++ maccessor.hh        12 Dec 2007 15:59:43 -0000      1.11
@@ -71,13 +71,9 @@
   int num_skip()const throw() {return my_skip;}
   typedef RowMajor layout;
 
-  inline DynamicMatrix<RefSkipMAccessor<ColMajor> >& T() {
-    return reinterpret_cast<DynamicMatrix<RefSkipMAccessor<ColMajor> 
>&>(*this);
-  }
+  inline DynamicMatrix<RefSkipMAccessor<ColMajor> >& T();
 
-  inline const DynamicMatrix<RefSkipMAccessor<ColMajor> >& T() const {
-    return reinterpret_cast<const DynamicMatrix<RefSkipMAccessor<ColMajor> 
>&>(*this);
-  }
+  inline const DynamicMatrix<RefSkipMAccessor<ColMajor> >& T() const;
 
   // slice
   template<int Rstart, int Cstart, int Rsize, int Csize>
@@ -193,6 +189,14 @@
   double* my_values;
 };
 
+inline DynamicMatrix<RefSkipMAccessor<ColMajor> >& 
RefSkipMAccessor<RowMajor>::T() {
+    return reinterpret_cast<DynamicMatrix<RefSkipMAccessor<ColMajor> 
>&>(*this);
+}
+
+inline const DynamicMatrix<RefSkipMAccessor<ColMajor> >& 
RefSkipMAccessor<RowMajor>::T() const {
+    return reinterpret_cast<const DynamicMatrix<RefSkipMAccessor<ColMajor> 
>&>(*this);
+}
+
 typedef RefSkipMAccessor<RowMajor>::RefSkipMatrixRM RefSkipMatrixRM;
 typedef RefSkipMAccessor<ColMajor>::RefSkipMatrixCM RefSkipMatrixCM;
 inline RefSkipMatrixRM makeRefSkipMatrixRM(int nr, int nc, int sk, double* v) 
{ RefSkipMatrixRM ret; ret.set(nr,nc,sk,v); return ret; }
@@ -230,12 +234,8 @@
   int num_skip()const throw() {return my_num_cols;}
   typedef RowMajor layout;
 
-  inline DynamicMatrix<DynamicMAccessor<ColMajor> >& T() {
-    return reinterpret_cast<DynamicMatrix<DynamicMAccessor<ColMajor> 
>&>(*this);
-  }
-  inline const DynamicMatrix<DynamicMAccessor<ColMajor> >& T() const {
-    return reinterpret_cast<const DynamicMatrix<DynamicMAccessor<ColMajor> 
>&>(*this);
-  }
+  inline DynamicMatrix<DynamicMAccessor<ColMajor> >& T();
+  inline const DynamicMatrix<DynamicMAccessor<ColMajor> >& T() const;
 
   // slice
   template<int Rstart, int Cstart, int Rsize, int Csize>
@@ -328,6 +328,14 @@
   double* my_values;
 };
 
+inline DynamicMatrix<DynamicMAccessor<ColMajor> >& 
DynamicMAccessor<RowMajor>::T() {
+    return reinterpret_cast<DynamicMatrix<DynamicMAccessor<ColMajor> 
>&>(*this);
+}
+inline const DynamicMatrix<DynamicMAccessor<ColMajor> >& 
DynamicMAccessor<RowMajor>::T() const {
+    return reinterpret_cast<const DynamicMatrix<DynamicMAccessor<ColMajor> 
>&>(*this);
+}
+
+
 typedef DynamicMatrix<DynamicMAccessor<RowMajor> > RefMatrixRM;
 typedef DynamicMatrix<DynamicMAccessor<ColMajor> > RefMatrixCM;
 inline RefMatrixRM makeRefMatrixRM(int nr, int nc, double* v) { RefMatrixRM 
ret; ret.set(nr,nc,v); return ret; }

Index: mbase.hh
===================================================================
RCS file: /cvsroot/toon/TooN/mbase.hh,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- mbase.hh    27 Sep 2007 13:32:29 -0000      1.11
+++ mbase.hh    12 Dec 2007 15:59:43 -0000      1.12
@@ -19,8 +19,6 @@
 */
 #ifndef __MBASE_HH
 #define __MBASE_HH
-#include <assert.h>
-
 
 template <class Accessor>
 class MatrixBase : public Accessor {
@@ -89,7 +87,8 @@
 ////////////////////////////////////////////////////////
 
 template<int Rows, int Cols, class Accessor>
-struct FixedMatrix : public MatrixBase<Accessor> {
+class FixedMatrix : public MatrixBase<Accessor> {
+public:
   // assignment from correct sized FixedMatrix
   template<class Accessor2>
   inline FixedMatrix& operator=(const FixedMatrix<Rows,Cols,Accessor2>& from){
@@ -114,7 +113,8 @@
 };
 
 template<class Accessor>
-struct DynamicMatrix : public MatrixBase<Accessor> {
+class DynamicMatrix : public MatrixBase<Accessor> {
+public:
   // assignment from any MatrixBase
   template<class Accessor2>
   DynamicMatrix& operator=(const MatrixBase<Accessor2>& from){

Index: mclasses.hh
===================================================================
RCS file: /cvsroot/toon/TooN/mclasses.hh,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- mclasses.hh 14 Jun 2006 11:46:23 -0000      1.9
+++ mclasses.hh 12 Dec 2007 15:59:43 -0000      1.10
@@ -58,7 +58,7 @@
 
 template <class Layout>
 class Matrix<General, General, Layout> : public 
DynamicMatrix<DynamicMAccessor<Layout> > {
-  friend class MSizer;
+  friend struct MSizer;
  public:
   inline Matrix(){
     this->my_num_rows = 0;
@@ -135,9 +135,7 @@
 struct MSizer {
   template<class Layout>
   static inline void set_size(Matrix<General,General,Layout>& ret, int rows, 
int cols){
-    ret.my_num_rows=rows;
-    ret.my_num_cols=cols;
-    ret.my_values = new double[rows*cols];
+    ret.set(rows, cols, new double[rows*cols]);
   }
 };
 

Index: membase.hh
===================================================================
RCS file: /cvsroot/toon/TooN/membase.hh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- membase.hh  27 Mar 2006 14:24:08 -0000      1.5
+++ membase.hh  12 Dec 2007 15:59:43 -0000      1.6
@@ -26,7 +26,11 @@
 class Stack {
 protected:
   double my_values[Size];
+#ifndef WIN32
 } __attribute__ ((aligned(16)));
+#else
+};
+#endif
 
 // the class allocates and deallocates the data on the heap
 template<int Size>

Index: vaccessor.hh
===================================================================
RCS file: /cvsroot/toon/TooN/vaccessor.hh,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- vaccessor.hh        15 Jan 2007 18:19:34 -0000      1.13
+++ vaccessor.hh        12 Dec 2007 15:59:43 -0000      1.14
@@ -32,7 +32,7 @@
 /////////////  DYNAMIC SIZED ACCESSORS ////////////////
 
 class DynamicVAccessor {
-  friend class VSizer;
+  friend struct VSizer;
 public:
   typedef DynamicVector<DynamicVAccessor> RefVector;
     

Index: vbase.hh
===================================================================
RCS file: /cvsroot/toon/TooN/vbase.hh,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- vbase.hh    27 Sep 2007 13:32:29 -0000      1.16
+++ vbase.hh    12 Dec 2007 15:59:43 -0000      1.17
@@ -21,10 +21,10 @@
 #define __VBASE_HH
 
 // VectorBase //
-#include <assert.h>
 
 template <class Accessor>
-struct VectorBase : public Accessor {
+class VectorBase : public Accessor {
+public:
   const double* get_data_ptr()const{return Accessor::my_values;}
   double* get_data_ptr(){return Accessor::my_values;}
 
@@ -59,7 +59,8 @@
 ////////////////////////////////////////////////////////
 
 template <int Size, class Accessor>
-struct FixedVector : public VectorBase<Accessor> {
+class FixedVector : public VectorBase<Accessor> {
+public:
   // assignment from correct sized FixedVector
   template<class Accessor2>
   inline FixedVector& operator=(const FixedVector<Size,Accessor2>& from){
@@ -113,8 +114,10 @@
 };
 
 template <class Accessor>
-struct DynamicVector : public VectorBase<Accessor>{
+class DynamicVector : public VectorBase<Accessor>{
   typedef VectorBase<Accessor> parent;
+
+public:
   // assignment from any VectorBase
   template<class Accessor2>
   DynamicVector& operator=(const VectorBase<Accessor2>& from){

Index: vclasses.hh
===================================================================
RCS file: /cvsroot/toon/TooN/vclasses.hh,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- vclasses.hh 15 Jan 2007 18:19:34 -0000      1.24
+++ vclasses.hh 12 Dec 2007 15:59:43 -0000      1.25
@@ -19,8 +19,6 @@
 #ifndef __VCLASSES_HH
 #define __VCLASSES_HH
 
-#include <assert.h>
-
 ///////////////////////////
 //                       //
 // Actual Vector classes //




reply via email to

[Prev in Thread] Current Thread [Next in Thread]