Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ShConcreteIntervalOpImpl.hpp

00001 #ifndef SHCONCRETEINTERVALOPIMPL_HPP 
00002 #define SHCONCRETEINTERVALOPIMPL_HPP
00003 
00004 #include <numeric>
00005 #include "ShEval.hpp"
00006 #include "ShVariant.hpp"
00007 #include "ShDebug.hpp"
00008 #include "ShError.hpp"
00009 #include "ShTypeInfo.hpp"
00010 
00011 // TODO replace zeros (SH_OP_DOT) with ShConcreteTypeInfo<V>::ZERO
00012 namespace SH {
00013 
00014 /* Partial specialization for different operations */ 
00015 
00016 template<typename T1, typename T2>
00017 struct ShConcreteIntervalOp<SH_OP_LO, T1, T2> {
00018   static void doop(ShDataVariant<T1, SH_HOST> &dest, 
00019     const ShDataVariant<T2, SH_HOST> &a)
00020   {
00021     SH_DEBUG_ASSERT(dest.size() == a.size());
00022     typename ShDataVariant<T1, SH_HOST>::iterator D = dest.begin();
00023     typename ShDataVariant<T2, SH_HOST>::const_iterator A = a.begin();
00024     
00025     for(;A != a.end(); ++A, ++D) (*D) = A->lo(); 
00026   }
00027 };
00028 
00029 template<typename T1, typename T2>
00030 struct ShConcreteIntervalOp<SH_OP_HI, T1, T2> {
00031   static void doop(ShDataVariant<T1, SH_HOST> &dest, 
00032     const ShDataVariant<T2, SH_HOST> &a)
00033   {
00034     SH_DEBUG_ASSERT(dest.size() == a.size());
00035     typename ShDataVariant<T1, SH_HOST>::iterator D = dest.begin();
00036     typename ShDataVariant<T2, SH_HOST>::const_iterator A = a.begin();
00037     
00038     for(;A != a.end(); ++A, ++D) (*D) = A->hi(); 
00039   }
00040 };
00041 
00042 
00043 template<typename T1, typename T2>
00044 struct ShConcreteIntervalOp<SH_OP_SETLO, T1, T2> {
00045   static void doop(ShDataVariant<T1, SH_HOST> &dest, 
00046     const ShDataVariant<T2, SH_HOST> &a)
00047   {
00048     SH_DEBUG_ASSERT(dest.size() == a.size());
00049     typename ShDataVariant<T1, SH_HOST>::iterator D = dest.begin();
00050     typename ShDataVariant<T2, SH_HOST>::const_iterator A = a.begin();
00051     
00052     for(;A != a.end(); ++A, ++D) D->lo() = (*A); 
00053   }
00054 };
00055 
00056 template<typename T1, typename T2>
00057 struct ShConcreteIntervalOp<SH_OP_SETHI, T1, T2> {
00058   static void doop(ShDataVariant<T1, SH_HOST> &dest, 
00059     const ShDataVariant<T2, SH_HOST> &a)
00060   {
00061     SH_DEBUG_ASSERT(dest.size() == a.size());
00062     typename ShDataVariant<T1, SH_HOST>::iterator D = dest.begin();
00063     typename ShDataVariant<T2, SH_HOST>::const_iterator A = a.begin();
00064     
00065     for(;A != a.end(); ++A, ++D) D->hi() = (*A); 
00066   }
00067 };
00068 
00069 }
00070 
00071 #endif

Generated on Mon Jan 24 18:36:31 2005 for Sh by  doxygen 1.4.1