CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #ifndef CommonTools_Utils_AndSelector_h
00002 #define CommonTools_Utils_AndSelector_h
00003 /* \class AndSelector
00004  *
00005  * \author Luca Lista, INFN
00006  *
00007  * $Id: AndSelector.h,v 1.1 2009/02/20 16:20:38 llista Exp $
00008  */
00009 
00010 namespace helpers {
00011   struct NullAndOperand;
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::NullAndOperand, typename S4 = helpers::NullAndOperand,
00022          typename S5 = helpers::NullAndOperand>
00023 struct AndSelector {
00024   AndSelector( 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 
00031 private:
00032   friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, S4, S5>;
00033   S1 s1_;
00034   S2 s2_;
00035   S3 s3_;
00036   S4 s4_;
00037   S5 s5_;
00038 };
00039 
00040 
00041 template<typename S1, typename S2>
00042 struct AndSelector<S1, S2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand> {
00043   AndSelector( const S1 & s1, const S2 & s2 ) :
00044     s1_( s1 ), s2_( s2 ) { }
00045   template<typename T>
00046   bool operator()( const T & t ) const { 
00047     return s1_( t ) && s2_( t );
00048   }
00049   template<typename T1, typename T2>
00050   bool operator()( const T1 & t1, const T2 & t2 ) const { 
00051     return s1_( t1 ) && s2_( t2 );
00052   }
00053 private:
00054   friend class reco::modules::CombinedEventSetupInit<S1, S2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand>;
00055   S1 s1_;
00056   S2 s2_;
00057 };
00058 
00059 template<typename S1, typename S2, typename S3>
00060 struct AndSelector<S1, S2, S3, helpers::NullAndOperand, helpers::NullAndOperand> {
00061   AndSelector( const S1 & s1, const S2 & s2, const S3 & s3 ) :
00062     s1_( s1 ), s2_( s2 ), s3_( s3 ) { }
00063   template<typename T>
00064   bool operator()( const T & t ) const { 
00065     return s1_( t ) && s2_( t ) && s3_( t );
00066   }
00067   template<typename T1, typename T2, typename T3>
00068   bool operator()( const T1 & t1,  const T2 & t2,  const T3 & t3 ) const {
00069     return s1_( t1 ) && s2_( t2 ) && s3_( t3 );
00070   }
00071 private:
00072   friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, helpers::NullAndOperand, helpers::NullAndOperand>;
00073   S1 s1_;
00074   S2 s2_;
00075   S3 s3_;
00076 };
00077 
00078 template<typename S1, typename S2, typename S3, typename S4>
00079 struct AndSelector<S1, S2, S3, S4, helpers::NullAndOperand> {
00080   AndSelector( const S1 & s1, const S2 & s2, const S3 & s3, const S4 & s4 ) :
00081     s1_( s1 ), s2_( s2 ), s3_( s3 ), s4_( s4 ) { }
00082   template<typename T>
00083   bool operator()( const T & t ) const { 
00084     return s1_( t ) && s2_( t ) && s3_( t ) && s4_( t );
00085   }
00086   template<typename T1, typename T2, typename T3, typename T4>
00087   bool operator()( const T1 & t1,  const T2 & t2,  const T3 & t3, const T4 & t4 ) const {
00088     return s1_( t1 ) && s2_( t2 ) && s3_( t3 ) && s4_( t4 );
00089   }
00090 private:
00091   friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, S4, helpers::NullAndOperand>;
00092   S1 s1_;
00093   S2 s2_;
00094   S3 s3_;
00095   S4 s4_;
00096 };
00097 
00098 #endif