toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN Doxyfile internal/allocator.hh test/slice_...


From: Edward Rosten
Subject: [Toon-members] TooN Doxyfile internal/allocator.hh test/slice_...
Date: Wed, 14 Oct 2009 11:20:36 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        09/10/14 11:20:36

Modified files:
        .              : Doxyfile 
        internal       : allocator.hh 
        test           : slice_test.cc 

Log message:
        Added get_data_ptr() method.
        
        This is only available for Vector and Matrix types which are contiguous.
        
        Currently ALL slice types are considered to be non-contiguous.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/Doxyfile?cvsroot=toon&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/allocator.hh?cvsroot=toon&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/TooN/test/slice_test.cc?cvsroot=toon&r1=1.6&r2=1.7

Patches:
Index: Doxyfile
===================================================================
RCS file: /cvsroot/toon/TooN/Doxyfile,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- Doxyfile    27 Aug 2009 17:26:34 -0000      1.11
+++ Doxyfile    14 Oct 2009 11:20:36 -0000      1.12
@@ -1116,3 +1116,6 @@
 # used. If set to NO the values of all tags below this one will be ignored.
 
 SEARCHENGINE           = NO
+
+FORMULA_FONTSIZE=15
+FORMULA_SMOOTH_TRANSPARENCY=YES

Index: internal/allocator.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/allocator.hh,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- internal/allocator.hh       28 Sep 2009 08:31:58 -0000      1.35
+++ internal/allocator.hh       14 Oct 2009 11:20:36 -0000      1.36
@@ -57,16 +57,6 @@
        {
                debug_initialize(my_data, Size);        
        }
-
-       Precision *data()
-       {
-               return my_data;
-       };
-
-       const Precision *data() const
-       {
-               return my_data;
-       };
        Precision my_data[Size];
 };
 
@@ -77,17 +67,6 @@
        {
                debug_initialize(my_data, Size);        
        }
-
-       double *data()
-       {
-               return my_data;
-       };
-
-       const double *data() const
-       {
-               return my_data;
-       };
-
        double my_data[Size] TOON_ALIGN8 ;
 };
 
@@ -109,16 +88,6 @@
 
                Precision *my_data;
 
-               Precision *data()
-               {
-                       return my_data;
-               };
-
-               const Precision *data() const
-               {
-                       return my_data;
-               };
-       
                StackOrHeap(const StackOrHeap& from)
                :my_data(new Precision[Size])
                {
@@ -158,6 +127,30 @@
                return Size;
        }
 
+       using StaticSizedAllocator<Size, Precision>::my_data;
+
+       Precision *get_data_ptr()
+       {
+               return my_data;
+       };
+
+       const Precision *get_data_ptr() const
+       {
+               return my_data;
+       }
+       
+       protected:
+
+               Precision *data()
+               {
+                       return my_data;
+               };
+
+               const Precision *data() const
+               {
+                       return my_data;
+               };
+
 };
 
 template<class Precision> struct VectorAlloc<Dynamic, Precision> {
@@ -192,6 +185,18 @@
                delete[] my_data;
        }
 
+       Precision *get_data_ptr()
+       {
+               return my_data;
+       };
+
+       const Precision *get_data_ptr() const
+       {
+               return my_data;
+       }
+
+       protected:
+
        Precision *data()
        {
                return my_data;
@@ -201,7 +206,6 @@
        {
                return my_data;
        };
-
 };
 
 
@@ -232,6 +236,18 @@
                        return numbers.size();
                }
 
+               Precision *get_data_ptr()
+               {
+                       return data();
+               };
+
+               const Precision *get_data_ptr() const
+               {
+                       return data();
+               }
+
+       protected:
+
                Precision* data() {
                        return &numbers[0];
                }
@@ -240,6 +256,8 @@
                        return &numbers[0];
                }
 
+       public:
+
                void resize(int s)
                {
                        int old_size = size();
@@ -267,6 +285,7 @@
        template<class Op>
        VectorSlice(const Operator<Op>& op) : my_data(op.data()) {}
 
+       protected:
        Precision *data()
        {
                return my_data;
@@ -294,6 +313,8 @@
                return my_size;
        }
 
+       protected:
+
        Precision *data()
        {
                return my_data;
@@ -423,6 +444,18 @@
        int num_cols() const {
                return C;
        }
+
+       using  StaticSizedAllocator<R*C, Precision>::my_data;
+
+       Precision* get_data_ptr()
+       {
+               return my_data;
+       }
+
+       const Precision* get_data_ptr() const 
+       {
+               return my_data;
+       }
 };
 
 
@@ -465,6 +498,16 @@
        ~MatrixAlloc() {
                delete[] my_data;
        }
+
+       Precision* get_data_ptr()
+       {
+               return my_data;
+       }
+
+       const Precision* get_data_ptr() const 
+       {
+               return my_data;
+       }
 };
 
 

Index: test/slice_test.cc
===================================================================
RCS file: /cvsroot/toon/TooN/test/slice_test.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- test/slice_test.cc  26 Aug 2009 09:51:09 -0000      1.6
+++ test/slice_test.cc  14 Oct 2009 11:20:36 -0000      1.7
@@ -2,6 +2,13 @@
 using namespace std;
 using namespace TooN;
 
+template<class M> void row(const M& m)
+{
+       for(int r=0; r< m.num_rows(); r++)
+               cout << m[r];
+       cout << endl;
+}
+
 int main()
 {
        Vector<6> v = makeVector(1, 2, 3, 4, 5, 6);
@@ -41,4 +48,46 @@
        Vector<200> w = Zeros;
 
        cout << w.slice<100,End<-99> >() << endl;
+
+       cout << endl << endl << endl;
+
+       Matrix<3> m = Data(1, 2, 3, 4, 5, 6, 7, 8, 9);
+       Matrix<>  n = m;
+       
+       row(m.slice<0,1,2,2>());
+       row(n.slice<0,1,2,2>());
+       row(m.slice(0,1,2,2));
+       row(n.slice(0,1,2,2));
+       row(m.slice<0      ,1      ,2      ,2      >(0, 1, 2, 2));
+       row(n.slice<0      ,1      ,2      ,2      >(0, 1, 2, 2));
+       row(m.slice<0      ,1      ,2      ,Dynamic>(0, 1, 2, 2));
+       row(n.slice<0      ,1      ,2      ,Dynamic>(0, 1, 2, 2));
+       row(m.slice<0      ,1      ,Dynamic,2      >(0, 1, 2, 2));
+       row(n.slice<0      ,1      ,Dynamic,2      >(0, 1, 2, 2));
+       row(m.slice<0      ,1      ,Dynamic,Dynamic>(0, 1, 2, 2));
+       row(n.slice<0      ,1      ,Dynamic,Dynamic>(0, 1, 2, 2));
+       row(m.slice<0      ,Dynamic,2      ,2      >(0, 1, 2, 2));
+       row(n.slice<0      ,Dynamic,2      ,2      >(0, 1, 2, 2));
+       row(m.slice<0      ,Dynamic,2      ,Dynamic>(0, 1, 2, 2));
+       row(n.slice<0      ,Dynamic,2      ,Dynamic>(0, 1, 2, 2));
+       row(m.slice<0      ,Dynamic,Dynamic,2      >(0, 1, 2, 2));
+       row(n.slice<0      ,Dynamic,Dynamic,2      >(0, 1, 2, 2));
+       row(m.slice<0      ,Dynamic,Dynamic,Dynamic>(0, 1, 2, 2));
+       row(n.slice<0      ,Dynamic,Dynamic,Dynamic>(0, 1, 2, 2));
+       row(m.slice<Dynamic,1      ,2      ,2      >(0, 1, 2, 2));
+       row(n.slice<Dynamic,1      ,2      ,2      >(0, 1, 2, 2));
+       row(m.slice<Dynamic,1      ,2      ,Dynamic>(0, 1, 2, 2));
+       row(n.slice<Dynamic,1      ,2      ,Dynamic>(0, 1, 2, 2));
+       row(m.slice<Dynamic,1      ,Dynamic,2      >(0, 1, 2, 2));
+       row(n.slice<Dynamic,1      ,Dynamic,2      >(0, 1, 2, 2));
+       row(m.slice<Dynamic,1      ,Dynamic,Dynamic>(0, 1, 2, 2));
+       row(n.slice<Dynamic,1      ,Dynamic,Dynamic>(0, 1, 2, 2));
+       row(m.slice<Dynamic,Dynamic,2      ,2      >(0, 1, 2, 2));
+       row(n.slice<Dynamic,Dynamic,2      ,2      >(0, 1, 2, 2));
+       row(m.slice<Dynamic,Dynamic,2      ,Dynamic>(0, 1, 2, 2));
+       row(n.slice<Dynamic,Dynamic,2      ,Dynamic>(0, 1, 2, 2));
+       row(m.slice<Dynamic,Dynamic,Dynamic,2      >(0, 1, 2, 2));
+       row(n.slice<Dynamic,Dynamic,Dynamic,2      >(0, 1, 2, 2));
+       row(m.slice<Dynamic,Dynamic,Dynamic,Dynamic>(0, 1, 2, 2));
+       row(n.slice<Dynamic,Dynamic,Dynamic,Dynamic>(0, 1, 2, 2));
 }




reply via email to

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