Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

Array2D.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Pattern_Array2D_h
00002 #define Impala_Core_Array_Pattern_Array2D_h
00003 
00004 
00005 namespace Impala
00006 {
00007 namespace Core
00008 {
00009 namespace Array
00010 {
00011 namespace Pattern
00012 {
00013 
00014 
00015 // TODO : remove this class
00016 template <class T>
00017 class Array2D {
00018 private:
00019     unsigned dims[2];
00020     T *ptr;
00021     Array2D();
00022 
00023 public:
00024 
00025     Array2D(const Array2D &);
00026     Array2D & operator = (Array2D &arg)//(const Array2D &arg)
00027     {
00028         for (unsigned i=0; i<dims[0]*dims[1]; i++) ptr[i]=arg[i];
00029         return *this;
00030     };
00031     ~Array2D() { delete []ptr; }
00032     Array2D(unsigned x, unsigned y, const T &val) {
00033         dims[0]=x;
00034         dims[1]=y;
00035         unsigned s=x*y;
00036         ptr = new T[s];
00037         for (unsigned i=0; i<s; i++) ptr[i]=val;
00038     }
00039     T & operator () (unsigned x, unsigned y) {
00040         return ptr[x+dims[0]*y];
00041     }
00042 
00043     T & operator [] (unsigned i) {
00044         return ptr[i];
00045     }
00046 
00047 
00048     int getDim(int n)
00049     {
00050         return dims[n];
00051     }
00052 
00053     /*
00054     HxImageRep MakeHxImage()
00055     {
00056         int pixelDimensionality=1;
00057         int dimensions=2;
00058         HxSizes sizes(dims[0],dims[1],1);
00059         //the data pointer for Hx should have 3 shorts per pixels?
00060         short* data= new short[dims[0]*dims[1]];
00061                     int i,j;
00062                     int height,width;
00063                     width=dims[0];
00064                     height=dims[1];
00065                     for(i=0;i<width;i++)
00066                         for(j=0;j<height;j++)
00067                         {
00068                             data[j*width+i]=ptr[j*width+i];
00069                         }
00070 
00071 
00072         HxImageRep gd = HxMakeFromShortData(
00073                         pixelDimensionality,
00074                         dimensions,
00075                         sizes,
00076                         data);
00077         return gd;
00078     }
00079     */
00080 };
00081 
00082 } // namespace Pattern
00083 } // namespace Array
00084 } // namespace Core
00085 } // namespace Impala
00086 
00087 #endif

Generated on Fri Mar 19 09:30:49 2010 for ImpalaSrc by  doxygen 1.5.1