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

ReduceAdaptor.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Trait_ReduceAdaptor_h
00002 #define Impala_Core_Array_Trait_ReduceAdaptor_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 
00006 namespace Impala
00007 {
00008 namespace Core
00009 {
00010 namespace Array
00011 {
00012 namespace Trait
00013 {
00014 
00015 
00016 template<class ReduceOpT>
00017 class ReduceAdaptor
00018 {
00019 public:
00020     typedef Pattern::TagPixOpOut       DirectionCategory;
00021     typedef Pattern::TagTransInVar     TransVarianceCategory;
00022     typedef Pattern::TagNPhase         PhaseCategory;
00023 
00024     typedef typename ReduceOpT::DstArithT ArithType;
00025 
00026     ReduceAdaptor()
00027     {
00028     }
00029 
00030     void
00031     DoIt(const ArithType& v)
00032     {
00033         mRedOp.DoIt(mR, v);
00034     }
00035 
00036     int
00037     NrPhases() const
00038     {
00039         return 1;
00040     }
00041 
00042     void
00043     Init(int)
00044     {
00045         mR = ReduceOpT::NeutralElement();
00046     }
00047 
00048     void
00049     Done(int)
00050     {
00051     }
00052 
00053     ArithType
00054     Result()
00055     {
00056         return mR;
00057     }
00058 
00059 private:
00060     ArithType           mR;
00061     ReduceOpT           mRedOp;
00062 };
00063 
00064 } // namespace Trait
00065 } // namespace Array
00066 } // namespace Core
00067 } // namespace Impala
00068 
00069 #endif

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