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

FuncUpo.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Pattern_FuncUpo_h
00002 #define Impala_Core_Array_Pattern_FuncUpo_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 #include "Core/Array/Pattern/ArrayFunc.h"
00006 #include "Core/Array/Pattern/PtrFunc.h"
00007 
00008 namespace Impala
00009 {
00010 namespace Core
00011 {
00012 namespace Array
00013 {
00014 namespace Pattern
00015 {
00016 
00017 
00020 template <class DstArrayT, class SrcArrayT, class UpoT>
00021 void
00022 FuncUpo(DstArrayT* dst, SrcArrayT* src, UpoT& upo,
00023         TagTransInVar dummy, TagCallValue dummy2)
00024 {
00025     typedef typename DstArrayT::StorType DstStorT;
00026     typedef typename DstArrayT::ArithType DstArithT;
00027     typedef typename SrcArrayT::StorType SrcStorT;
00028     typedef typename SrcArrayT::ArithType SrcArithT;
00029 
00030     int width = ArrayCW(dst);
00031     int height = ArrayCH(dst);
00032     for (int y=0 ; y<height ; y++)
00033     {
00034         SrcStorT* sPtr = ArrayCPB(src, 0, y);
00035         DstStorT* dPtr = ArrayCPB(dst, 0, y);
00036         for (int x=0 ; x<width ; x++)
00037         {
00038             PtrWrite(dPtr, upo.DoIt(PtrRead(sPtr, SrcArithT())));
00039             dPtr += DstArrayT::ElemSize();
00040             sPtr += SrcArrayT::ElemSize();
00041         }
00042     }
00043 }
00044 
00045 template <class DstArrayT, class SrcArrayT, class UpoT>
00046 void
00047 FuncUpo(DstArrayT* dst, SrcArrayT* src, UpoT& upo,
00048         TagTransInVar dummy, TagCallPointer dummy2)
00049 {
00050     typedef typename DstArrayT::StorType DstStorT;
00051     typedef typename DstArrayT::ArithType DstArithT;
00052     typedef typename SrcArrayT::StorType SrcStorT;
00053     typedef typename SrcArrayT::ArithType SrcArithT;
00054 
00055     int width = ArrayCW(dst);
00056     int height = ArrayCH(dst);
00057     for (int y=0 ; y<height ; y++)
00058     {
00059         SrcStorT* sPtr = ArrayCPB(src, 0, y);
00060         DstStorT* dPtr = ArrayCPB(dst, 0, y);
00061         for (int x=0 ; x<width ; x++)
00062         {
00063             upo.DoIt(dPtr, sPtr);
00064             dPtr += DstArrayT::ElemSize();
00065             sPtr += SrcArrayT::ElemSize();
00066         }
00067     }
00068 }
00069 
00087 /****************************************
00088  * test case for Coordination Eumerator *
00089  ****************************************/
00090 
00091 /*
00092 #include "Ops/Array/Trait/CoordinateEnumerators.h"
00093 
00094 template <class DstArrayT, class SrcArrayT, class UpoT, class CE>
00095 void
00096 FuncUpoCE(DstArrayT* dst, SrcArrayT* src, UpoT& upo, CE& ce,
00097           TagTransInVar dummy, TagCallValue dummy2)
00098 {
00099     typedef typename DstArrayT::StorType DstStorT;
00100     typedef typename DstArrayT::ArithType DstArithT;
00101     typedef typename SrcArrayT::StorType SrcStorT;
00102     typedef typename SrcArrayT::ArithType SrcArithT;
00103 
00104     while (!ce.Done())
00105     {
00106         PtrWrite(ce.DstPointer(dst), upo.DoIt(PtrRead(ce.SrcPointer(src), SrcArithT())));
00107         ce.NextCoordinate(dst,src);
00108     }
00109 }
00110 
00111 template <class DstArrayT, class SrcArrayT, class UpoT, class CE>
00112 void
00113 FuncUpoCE(DstArrayT* dst, SrcArrayT* src, UpoT& upo, CE& ce,
00114           TagTransInVar dummy, TagCallPointer dummy2)
00115 {
00116     while (!ce.Done())
00117     {
00118         upo.DoIt(ce.DstPointer(dst), ce.SrcPointer(src));
00119         ce.NextCoordinate(dst,src);
00120     }
00121 }
00122 */
00123 
00126 template <class DstArrayT, class SrcArrayT, class UpoT>
00127 void
00128 FuncUpoDispatch(DstArrayT* dst, SrcArrayT* src, UpoT& upo)
00129 {
00130     FuncUpo(dst, src, upo, typename UpoT::TransVarianceCategory(),
00131               typename UpoT::CallCategory());
00132 }
00133 
00134 } // namespace Pattern
00135 } // namespace Array
00136 } // namespace Core
00137 } // namespace Impala
00138 
00139 #endif

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