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

UpoLut.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Trait_UpoLut_h
00002 #define Impala_Core_Array_Trait_UpoLut_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 #include <vector>
00006 
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Array
00012 {
00013 namespace Trait
00014 {
00015 
00016 
00019 template<class DstArrayT, class SrcArrayT>
00020 class UpoLut
00021 {
00022 public:
00023 
00025     typedef Pattern::TagTransInVar TransVarianceCategory;
00026 
00028     typedef Pattern::TagCallValue CallCategory;
00029 
00030     typedef typename DstArrayT::ArithType DstArithT;
00031     typedef typename SrcArrayT::ArithType SrcArithT;
00032 
00033     UpoLut(std::vector<int>* lut, int notInLutVal)
00034     {
00035         mLut = lut;
00036         mNotInLutVal = notInLutVal;
00037     }
00038 
00039     DstArithT
00040     DoIt(const SrcArithT& x)
00041     {
00042         if ((x < 0) || (x >= mLut->size()))
00043             return mNotInLutVal;
00044         return (*mLut)[x];
00045     }
00046 
00047 private:
00048 
00049     std::vector<int>* mLut;
00050     int mNotInLutVal;
00051 };
00052 
00053 } // namespace Trait
00054 } // namespace Array
00055 } // namespace Core
00056 } // namespace Impala
00057 
00058 #endif

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