CMS 3D CMS Logo

ParametricTrait.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_Utilities_ParametricTrait_h
00002 #define PhysicsTools_Utilities_ParametricTrait_h
00003 
00004 #include "PhysicsTools/Utilities/interface/Functions.h"
00005 #include "PhysicsTools/Utilities/interface/Fraction.h"
00006 #include "PhysicsTools/Utilities/interface/Operations.h"
00007 
00008 namespace funct {
00009 
00010   template<typename F> 
00011   struct Parametric { 
00012     static const int value = 1; 
00013   };
00014 
00015   template<int n> 
00016   struct Parametric<Numerical<n> > { 
00017     static const int value = 0; 
00018   };
00019 
00020  template<int n, int m> 
00021  struct Parametric<FractionStruct<n, m> > { 
00022     static const int value = 0; 
00023  };
00024  
00025 #define NON_PARAMETRIC( FUN ) \
00026 template<> struct Parametric<FUN> { \
00027   static const int value = 0; \
00028 }
00029 
00030 #define NON_PARAMETRIC_UNARY(FUN) \
00031 template<typename A> \
00032 struct Parametric<FUN<A> > { \
00033   static const int value = Parametric<A>::value; \
00034 }
00035  
00036  NON_PARAMETRIC_UNARY(AbsStruct);
00037  NON_PARAMETRIC_UNARY(SgnStruct);
00038  NON_PARAMETRIC_UNARY(ExpStruct);
00039  NON_PARAMETRIC_UNARY(LogStruct);
00040  NON_PARAMETRIC_UNARY(SinStruct);
00041  NON_PARAMETRIC_UNARY(CosStruct);
00042  NON_PARAMETRIC_UNARY(TanStruct);
00043  NON_PARAMETRIC_UNARY(MinusStruct);
00044  
00045 #define NON_PARAMETRIC_BINARY(FUN) \
00046 template<typename A, typename B> \
00047 struct Parametric<FUN<A, B> > { \
00048   static const int value = Parametric<A>::value || Parametric<A>::value; \
00049 }
00050 
00051  NON_PARAMETRIC_BINARY(SumStruct);
00052  NON_PARAMETRIC_BINARY(ProductStruct);
00053  NON_PARAMETRIC_BINARY(RatioStruct);
00054  NON_PARAMETRIC_BINARY(PowerStruct);
00055  
00056 #undef NON_PARAMETRIC_UNARY
00057 #undef NON_PARAMETRIC_BINARY
00058 
00059 }
00060 
00061 
00062 #endif

Generated on Tue Jun 9 17:42:43 2009 for CMSSW by  doxygen 1.5.4