CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OrSelector.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_OrSelector_h
2 #define CommonTools_Utils__OrSelector_h
3 /* \class OrSelector
4  *
5  * \author Luca Lista, INFN
6  *
7  * $Id: OrSelector.h,v 1.1 2009/02/24 14:40:26 llista Exp $
8  */
9 
10 namespace helpers {
11  struct NullOrOperand;
12 }
13 
14 namespace reco {
15  namespace modules {
16  template<typename T1, typename T2, typename T3, typename T4, typename T5> struct CombinedEventSetupInit;
17  }
18 }
19 
20 template<typename S1, typename S2,
21  typename S3 = helpers::NullOrOperand, typename S4 = helpers::NullOrOperand,
22  typename S5 = helpers::NullOrOperand>
23 struct OrSelector {
24  OrSelector( const S1 & s1, const S2 & s2, const S3 & s3, const S4 & s4, const S5 & s5 ) :
25  s1_( s1 ), s2_( s2 ), s3_( s3 ), s4_( s4 ), s5_( s5 ) { }
26  template<typename T>
27  bool operator()( const T & t ) const {
28  return s1_( t ) || s2_( t ) || s3_( t ) || s4_( t ) || s5_( t );
29  }
30 private:
31  friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, S4, S5>;
32  S1 s1_;
33  S2 s2_;
34  S3 s3_;
35  S4 s4_;
36  S5 s5_;
37 };
38 
39 
40 template<typename S1, typename S2>
41 struct OrSelector<S1, S2, helpers::NullOrOperand, helpers::NullOrOperand, helpers::NullOrOperand> {
42  OrSelector( const S1 & s1, const S2 & s2 ) :
43  s1_( s1 ), s2_( s2 ) { }
44 
45  template<typename T>
46  bool operator()( const T & t ) const {
47  return s1_( t ) || s2_( t );
48  }
49 private:
50  friend class reco::modules::CombinedEventSetupInit<S1, S2, helpers::NullOrOperand, helpers::NullOrOperand, helpers::NullOrOperand>;
51  S1 s1_;
52  S2 s2_;
53 };
54 
55 template<typename S1, typename S2, typename S3>
56 struct OrSelector<S1, S2, S3, helpers::NullOrOperand, helpers::NullOrOperand> {
57  OrSelector( const S1 & s1, const S2 & s2, const S3 & s3 ) :
58  s1_( s1 ), s2_( s2 ), s3_( s3 ) { }
59  template<typename T>
60  bool operator()( const T & t ) const {
61  return s1_( t ) || s2_( t ) || s3_( t );
62  }
63 private:
64  friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, helpers::NullOrOperand, helpers::NullOrOperand>;
65  S1 s1_;
66  S2 s2_;
67  S3 s3_;
68 };
69 
70 template<typename S1, typename S2, typename S3, typename S4>
71 struct OrSelector<S1, S2, S3, S4, helpers::NullOrOperand> {
72  OrSelector( const S1 & s1, const S2 & s2, const S3 & s3, const S4 & s4 ) :
73  s1_( s1 ), s2_( s2 ), s3_( s3 ), s4_( s4 ) { }
74  template<typename T>
75  bool operator()( const T & t ) const {
76  return s1_( t ) || s2_( t ) || s3_( t ) || s4_( t );
77  }
78 private:
79  friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, S4, helpers::NullOrOperand>;
80  S1 s1_;
81  S2 s2_;
82  S3 s3_;
83  S4 s4_;
84 };
85 
86 #endif
OrSelector(const S1 &s1, const S2 &s2, const S3 &s3, const S4 &s4)
Definition: OrSelector.h:72
tuple s2
Definition: indexGen.py:106
bool operator()(const T &t) const
Definition: OrSelector.h:27
OrSelector(const S1 &s1, const S2 &s2, const S3 &s3, const S4 &s4, const S5 &s5)
Definition: OrSelector.h:24
long double T
def template
Definition: svgfig.py:520