CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CommonTools/Utils/interface/OrSelector.h

Go to the documentation of this file.
00001 #ifndef CommonTools_Utils_OrSelector_h
00002 #define CommonTools_Utils__OrSelector_h
00003 /* \class OrSelector
00004  *
00005  * \author Luca Lista, INFN
00006  *
00007  * $Id: OrSelector.h,v 1.1 2009/02/24 14:40:26 llista Exp $
00008  */
00009 
00010 namespace helpers {
00011   struct NullOrOperand;
00012 }
00013 
00014 namespace reco {
00015   namespace modules {
00016     template<typename T1, typename T2, typename T3, typename T4, typename T5> struct CombinedEventSetupInit;
00017   }
00018 }
00019 
00020 template<typename S1, typename S2, 
00021          typename S3 = helpers::NullOrOperand, typename S4 = helpers::NullOrOperand,
00022          typename S5 = helpers::NullOrOperand>
00023 struct OrSelector {
00024   OrSelector( const S1 & s1, const S2 & s2, const S3 & s3, const S4 & s4, const S5 & s5 ) :
00025     s1_( s1 ), s2_( s2 ), s3_( s3 ), s4_( s4 ), s5_( s5 ) { }
00026   template<typename T>
00027   bool operator()( const T & t ) const { 
00028     return s1_( t ) || s2_( t ) || s3_( t ) || s4_( t ) || s5_( t );
00029   }
00030 private:
00031   friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, S4, S5>;
00032   S1 s1_;
00033   S2 s2_;
00034   S3 s3_;
00035   S4 s4_;
00036   S5 s5_;
00037 };
00038 
00039 
00040 template<typename S1, typename S2>
00041 struct OrSelector<S1, S2, helpers::NullOrOperand, helpers::NullOrOperand, helpers::NullOrOperand> {
00042   OrSelector( const S1 & s1, const S2 & s2 ) :
00043     s1_( s1 ), s2_( s2 ) { }
00044 
00045   template<typename T>
00046   bool operator()( const T & t ) const { 
00047     return s1_( t ) || s2_( t );
00048   }
00049 private:
00050   friend class reco::modules::CombinedEventSetupInit<S1, S2, helpers::NullOrOperand, helpers::NullOrOperand, helpers::NullOrOperand>;
00051   S1 s1_;
00052   S2 s2_;
00053 };
00054 
00055 template<typename S1, typename S2, typename S3>
00056 struct OrSelector<S1, S2, S3, helpers::NullOrOperand, helpers::NullOrOperand> {
00057   OrSelector( const S1 & s1, const S2 & s2, const S3 & s3 ) :
00058     s1_( s1 ), s2_( s2 ), s3_( s3 ) { }
00059   template<typename T>
00060   bool operator()( const T & t ) const { 
00061     return s1_( t ) || s2_( t ) || s3_( t );
00062   }
00063 private:
00064   friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, helpers::NullOrOperand, helpers::NullOrOperand>;
00065   S1 s1_;
00066   S2 s2_;
00067   S3 s3_;
00068 };
00069 
00070 template<typename S1, typename S2, typename S3, typename S4>
00071 struct OrSelector<S1, S2, S3, S4, helpers::NullOrOperand> {
00072   OrSelector( const S1 & s1, const S2 & s2, const S3 & s3, const S4 & s4 ) :
00073     s1_( s1 ), s2_( s2 ), s3_( s3 ), s4_( s4 ) { }
00074   template<typename T>
00075   bool operator()( const T & t ) const { 
00076     return s1_( t ) || s2_( t ) || s3_( t ) || s4_( t );
00077   }
00078 private:
00079   friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, S4, helpers::NullOrOperand>;
00080   S1 s1_;
00081   S2 s2_;
00082   S3 s3_;
00083   S4 s4_;
00084 };
00085 
00086 #endif