Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:18

0001 #ifndef CommonTools_Utils_OrSelector_h
0002 #define CommonTools_Utils_OrSelector_h
0003 /* \class OrSelector
0004  *
0005  * \author Luca Lista, INFN
0006  *
0007  * $Id: OrSelector.h,v 1.6 2008/05/20 15:13:27 piccolo Exp $
0008  */
0009 
0010 namespace helpers {
0011   struct NullOrOperand;
0012 }
0013 
0014 namespace reco {
0015   namespace modules {
0016     template <typename T1, typename T2, typename T3, typename T4, typename T5>
0017     struct CombinedEventSetupInit;
0018   }
0019 }  // namespace reco
0020 
0021 template <typename S1,
0022           typename S2,
0023           typename S3 = helpers::NullOrOperand,
0024           typename S4 = helpers::NullOrOperand,
0025           typename S5 = helpers::NullOrOperand>
0026 struct OrSelector {
0027   OrSelector(const S1& s1, const S2& s2, const S3& s3, const S4& s4, const S5& s5)
0028       : s1_(s1), s2_(s2), s3_(s3), s4_(s4), s5_(s5) {}
0029   template <typename T>
0030   bool operator()(const T& t) const {
0031     return s1_(t) || s2_(t) || s3_(t) || s4_(t) || s5_(t);
0032   }
0033 
0034 private:
0035   friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, S4, S5>;
0036   S1 s1_;
0037   S2 s2_;
0038   S3 s3_;
0039   S4 s4_;
0040   S5 s5_;
0041 };
0042 
0043 template <typename S1, typename S2>
0044 struct OrSelector<S1, S2, helpers::NullOrOperand, helpers::NullOrOperand, helpers::NullOrOperand> {
0045   OrSelector(const S1& s1, const S2& s2) : s1_(s1), s2_(s2) {}
0046 
0047   template <typename T>
0048   bool operator()(const T& t) const {
0049     return s1_(t) || s2_(t);
0050   }
0051 
0052 private:
0053   friend class reco::modules::
0054       CombinedEventSetupInit<S1, S2, helpers::NullOrOperand, helpers::NullOrOperand, helpers::NullOrOperand>;
0055   S1 s1_;
0056   S2 s2_;
0057 };
0058 
0059 template <typename S1, typename S2, typename S3>
0060 struct OrSelector<S1, S2, S3, helpers::NullOrOperand, helpers::NullOrOperand> {
0061   OrSelector(const S1& s1, const S2& s2, const S3& s3) : s1_(s1), s2_(s2), s3_(s3) {}
0062   template <typename T>
0063   bool operator()(const T& t) const {
0064     return s1_(t) || s2_(t) || s3_(t);
0065   }
0066 
0067 private:
0068   friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, helpers::NullOrOperand, helpers::NullOrOperand>;
0069   S1 s1_;
0070   S2 s2_;
0071   S3 s3_;
0072 };
0073 
0074 template <typename S1, typename S2, typename S3, typename S4>
0075 struct OrSelector<S1, S2, S3, S4, helpers::NullOrOperand> {
0076   OrSelector(const S1& s1, const S2& s2, const S3& s3, const S4& s4) : s1_(s1), s2_(s2), s3_(s3), s4_(s4) {}
0077   template <typename T>
0078   bool operator()(const T& t) const {
0079     return s1_(t) || s2_(t) || s3_(t) || s4_(t);
0080   }
0081 
0082 private:
0083   friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, S4, helpers::NullOrOperand>;
0084   S1 s1_;
0085   S2 s2_;
0086   S3 s3_;
0087   S4 s4_;
0088 };
0089 
0090 #endif