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

Array2d.h

Go to the documentation of this file.
00001 #ifndef Array2d_h
00002 #define Array2d_h
00003 
00004 #include "Core/Array/Arrays.h"
00005 
00006 namespace ChorusWrapper {
00007 
00008 using Impala::Core::Array::Array2dVec3UInt8;
00009 using Impala::Core::Array::Array2dVec3Real64;
00010 using Impala::Core::Array::Array2dVec2Real64;
00011 
00012 
00013 class Array2d
00014 {
00015     // This class provides an abstract interface to all Chorus 2D arrays, abstracting from
00016     // the array elements' type, using delegation in order not to affect the CxArray2dTem
00017     // template class' implementation. See also CxArray2d.
00018     //
00019 
00020 public:
00021     
00022     static const int DATA_TYPE_VEC3_UINT = 0;
00023     static const int DATA_TYPE_VEC3_REAL64 = 2;
00024     static const int DATA_TYPE_VEC2_REAL64 = 3;
00025 
00026     Array2d(Array2dVec3UInt8* data) : mDataType(0), mDataVec3UInt8(data), mDataVec3Real64(0), mDataVec2Real64(0)
00027     {
00028     }
00029 
00030     Array2d(Array2dVec3Real64* data) : mDataType(2), mDataVec3Real64(data), mDataVec3UInt8(0), mDataVec2Real64(0)
00031     {
00032     }
00033 
00034     Array2d(Array2dVec2Real64* data) : mDataType(3), mDataVec2Real64(data), mDataVec3UInt8(0), mDataVec3Real64(0)
00035     {
00036     }
00037 
00038     Array2d(const Array2d& src) : mDataType(src.mDataType), mDataVec3Real64(0), mDataVec3UInt8(0), mDataVec2Real64(0)
00039     {
00040         switch (mDataType) {
00041             case 0:
00042                 mDataVec3UInt8 = new Array2dVec3UInt8(*(src.mDataVec3UInt8));
00043                 break;
00044             case 2:
00045                 mDataVec3Real64 = new Array2dVec3Real64(*(src.mDataVec3Real64));
00046                 break;
00047             case 3:
00048                 mDataVec2Real64 = new Array2dVec2Real64(*(src.mDataVec2Real64));
00049                 break;
00050         }
00051     }
00052 
00053     ~Array2d()
00054     {
00055         switch (mDataType) {
00056             case 0:
00057                 delete mDataVec3UInt8;
00058                 break;
00059             case 2:
00060                 delete mDataVec3Real64;
00061                 break;
00062             case 3:
00063                 delete mDataVec2Real64;
00064                 break;
00065         }
00066     }
00067 
00068     int CW() const 
00069     {
00070         switch (mDataType) {
00071             case 0:
00072                 return mDataVec3UInt8->CW();
00073             case 2:
00074                 return mDataVec3Real64->CW();
00075             case 3:
00076                 return mDataVec2Real64->CW();
00077         }
00078         return 0;
00079     }
00080 
00081     int CH() const 
00082     {
00083         switch (mDataType) {
00084             case 0:
00085                 return mDataVec3UInt8->CH();
00086             case 2:
00087                 return mDataVec3Real64->CH();
00088             case 3:
00089                 return mDataVec2Real64->CH();
00090         }
00091         return 0;
00092     }
00093 
00094     int mDataType;
00095 
00096     Array2dVec3UInt8* mDataVec3UInt8;
00097     Array2dVec3Real64* mDataVec3Real64;
00098     Array2dVec2Real64* mDataVec2Real64;
00099 };
00100 
00101 
00102 }//namespace ChorusWrapper
00103 
00104 #endif
00105 

Generated on Fri Mar 19 09:31:03 2010 for ImpalaSrc by  doxygen 1.5.1