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

TalkNgbExtraP1Cnum.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Trait_TalkNgbExtraP1Cnum_h
00002 #define Impala_Core_Array_Trait_TalkNgbExtraP1Cnum_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 #include "Core/Array/Pattern/Cnum.h"
00006 #include "Core/Array/Element/E1Cast.h"
00007 
00008 namespace Impala
00009 {
00010 namespace Core
00011 {
00012 namespace Array
00013 {
00014 namespace Trait
00015 {
00016 
00017 
00020 template<class DstArrayT, class SrcArrayT, class ExtraArrayT>
00021 class TalkNgbExtraP1Cnum
00022 {
00023 public:
00024 
00026     typedef Pattern::TagCnum IteratorCategory;
00027 
00029     typedef Pattern::Tag1Phase PhaseCategory;
00030 
00032     typedef Pattern::Cnum CnumType;
00033 
00034     typedef typename DstArrayT::StorType DstStorType;
00035     typedef typename DstArrayT::ArithType DstArithType;
00036     typedef typename SrcArrayT::StorType SrcStorType;
00037     typedef typename SrcArrayT::ArithType SrcArithType;
00038     typedef typename ExtraArrayT::StorType ExtraStorType;
00039     typedef typename ExtraArrayT::ArithType ExtraArithType;
00040 
00042     TalkNgbExtraP1Cnum(bool verbose)
00043     {
00044         mVerbose = verbose;
00045     }
00046 
00048     int
00049     Width()
00050     {
00051         return 3;
00052     }
00053 
00055     int
00056     Height()
00057     {
00058         return 3;
00059     }
00060 
00062     CnumType
00063     Begin()
00064     {
00065         return mBegin;
00066     }
00067 
00069     CnumType&
00070     End()
00071     {
00072         return mEnd;
00073     }
00074 
00076     void
00077     Init(int x, int y, const SrcArithType& v1, const ExtraArithType& v2)
00078     {
00079         if (mVerbose)
00080             std::cout << "  TalkNgbExtraP1Cnum::init(" << x << "," << y << ","
00081                       << v1 << "," << v2 << ") " << std::endl;
00082         mBegin = CnumType(&mCoordPairs[0]);
00083         mEnd = CnumType(&mCoordPairs[8]);
00084         mResult = Element::E1Cast(0, DstArithType());
00085     }
00086 
00088     void
00089     NextEl(int x, int y, const SrcArithType& v1, const ExtraArithType& v2)
00090     {
00091         if (mVerbose)
00092             std::cout << "      TalkNgbExtraP1Cnum::next(" << x << "," << y
00093                       << "," << v1 << "," << v2 << ") " << std::endl;
00094         DstArithType tmp(v1, v2, 0);
00095         mResult += tmp;
00096     }
00097 
00099     DstArithType
00100     Result() const
00101     {
00102         return mResult;
00103     }
00104 
00105 private:
00106     DstArithType   mResult;
00107     bool           mVerbose;
00108     CnumType       mBegin;
00109     CnumType       mEnd;
00110     static Pattern::Coord mCoordPairs[8];
00111 };
00112 
00113 
00114 template<class DstArrayT, class SrcArrayT, class ExtraArrayT>
00115 Pattern::Coord TalkNgbExtraP1Cnum<DstArrayT,SrcArrayT,ExtraArrayT>::mCoordPairs[8] = 
00116 {
00117     { -1, -1 },
00118     {  0, -1 },
00119     {  1, -1 },
00120     {  1,  0 },
00121     {  1,  1 },
00122     {  0,  1 },
00123     { -1,  1 },
00124     {  0, -1 }
00125 };
00126 
00127 } // namespace Trait
00128 } // namespace Array
00129 } // namespace Core
00130 } // namespace Impala
00131 
00132 #endif

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