CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/FWCore/Framework/interface/moduleAbilities.h

Go to the documentation of this file.
00001 #ifndef FWCore_Framework_moduleAbilities_h
00002 #define FWCore_Framework_moduleAbilities_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     FWCore/Framework
00006 // Class  :     moduleAbilities
00007 // 
00016 //
00017 // Original Author:  Chris Jones
00018 //         Created:  Tue, 07 May 2013 19:19:53 GMT
00019 // $Id: moduleAbilities.h,v 1.1 2013/05/17 14:49:43 chrjones Exp $
00020 //
00021 
00022 // system include files
00023 #include "boost/mpl/if.hpp"
00024 
00025 // user include files
00026 #include "FWCore/Framework/interface/moduleAbilityEnums.h"
00027 
00028 // forward declarations
00029 
00030 namespace edm {
00031   namespace module {
00032     //Used in the case where ability is not available
00033     struct Empty{};
00034   }
00035   
00036   template<typename T>
00037   struct GlobalCache {
00038     static constexpr module::Abilities kAbilities=module::Abilities::kGlobalCache;
00039     typedef T Type;
00040   };
00041   
00042   template<typename T>
00043   struct StreamCache {
00044     static constexpr module::Abilities kAbilities=module::Abilities::kStreamCache;
00045     typedef T Type;
00046   };
00047   
00048   template<typename T>
00049   struct RunCache {
00050     static constexpr module::Abilities kAbilities=module::Abilities::kRunCache;
00051     typedef T Type;
00052   };
00053   
00054   template<typename T>
00055   struct LuminosityBlockCache {
00056     static constexpr module::Abilities kAbilities=module::Abilities::kLuminosityBlockCache;
00057     typedef T Type;
00058   };
00059   
00060   template<typename T>
00061   struct RunSummaryCache {
00062     static constexpr module::Abilities kAbilities=module::Abilities::kRunSummaryCache;
00063     typedef T Type;
00064   };
00065   
00066   template<typename T>
00067   struct LuminosityBlockSummaryCache {
00068     static constexpr module::Abilities kAbilities=module::Abilities::kLuminosityBlockSummaryCache;
00069     typedef T Type;
00070   };
00071   
00072   struct BeginRunProducer {
00073     static constexpr module::Abilities kAbilities=module::Abilities::kBeginRunProducer;
00074     typedef module::Empty Type;
00075   };
00076 
00077   struct EndRunProducer {
00078     static constexpr module::Abilities kAbilities=module::Abilities::kEndRunProducer;
00079     typedef module::Empty Type;
00080   };
00081 
00082   struct BeginLuminosityBlockProducer {
00083     static constexpr module::Abilities kAbilities=module::Abilities::kBeginLuminosityBlockProducer;
00084     typedef module::Empty Type;
00085   };
00086   
00087   struct EndLuminosityBlockProducer {
00088     static constexpr module::Abilities kAbilities=module::Abilities::kEndLuminosityBlockProducer;
00089     typedef module::Empty Type;
00090   };
00091 
00092   
00093   //Recursively checks VArgs template arguments looking for the ABILITY
00094   template<module::Abilities ABILITY, typename... VArgs> struct CheckAbility;
00095   
00096   template<module::Abilities ABILITY, typename T, typename... VArgs>
00097   struct CheckAbility<ABILITY,T,VArgs...> {
00098     static constexpr bool kHasIt = (T::kAbilities==ABILITY) | CheckAbility<ABILITY,VArgs...>::kHasIt;
00099     typedef typename boost::mpl::if_c<(T::kAbilities==ABILITY),
00100     typename T::Type,
00101     typename CheckAbility<ABILITY,VArgs...>::Type>::type Type;
00102   };
00103   
00104   //End of the recursion
00105   template<module::Abilities ABILITY>
00106   struct CheckAbility<ABILITY> {
00107     static constexpr bool kHasIt=false;
00108     typedef edm::module::Empty Type;
00109   };
00110 
00111 }
00112 
00113 #endif