OrSelector

OrSelector

OrSelector

OrSelector

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
#ifndef CommonTools_Utils_OrSelector_h
#define CommonTools_Utils_OrSelector_h
/* \class OrSelector
 *
 * \author Luca Lista, INFN
 *
 * $Id: OrSelector.h,v 1.6 2008/05/20 15:13:27 piccolo Exp $
 */

namespace helpers {
  struct NullOrOperand;
}

namespace reco {
  namespace modules {
    template <typename T1, typename T2, typename T3, typename T4, typename T5>
    struct CombinedEventSetupInit;
  }
}  // namespace reco

template <typename S1,
          typename S2,
          typename S3 = helpers::NullOrOperand,
          typename S4 = helpers::NullOrOperand,
          typename S5 = helpers::NullOrOperand>
struct OrSelector {
  OrSelector(const S1& s1, const S2& s2, const S3& s3, const S4& s4, const S5& s5)
      : s1_(s1), s2_(s2), s3_(s3), s4_(s4), s5_(s5) {}
  template <typename T>
  bool operator()(const T& t) const {
    return s1_(t) || s2_(t) || s3_(t) || s4_(t) || s5_(t);
  }

private:
  friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, S4, S5>;
  S1 s1_;
  S2 s2_;
  S3 s3_;
  S4 s4_;
  S5 s5_;
};

template <typename S1, typename S2>
struct OrSelector<S1, S2, helpers::NullOrOperand, helpers::NullOrOperand, helpers::NullOrOperand> {
  OrSelector(const S1& s1, const S2& s2) : s1_(s1), s2_(s2) {}

  template <typename T>
  bool operator()(const T& t) const {
    return s1_(t) || s2_(t);
  }

private:
  friend class reco::modules::
      CombinedEventSetupInit<S1, S2, helpers::NullOrOperand, helpers::NullOrOperand, helpers::NullOrOperand>;
  S1 s1_;
  S2 s2_;
};

template <typename S1, typename S2, typename S3>
struct OrSelector<S1, S2, S3, helpers::NullOrOperand, helpers::NullOrOperand> {
  OrSelector(const S1& s1, const S2& s2, const S3& s3) : s1_(s1), s2_(s2), s3_(s3) {}
  template <typename T>
  bool operator()(const T& t) const {
    return s1_(t) || s2_(t) || s3_(t);
  }

private:
  friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, helpers::NullOrOperand, helpers::NullOrOperand>;
  S1 s1_;
  S2 s2_;
  S3 s3_;
};

template <typename S1, typename S2, typename S3, typename S4>
struct OrSelector<S1, S2, S3, S4, helpers::NullOrOperand> {
  OrSelector(const S1& s1, const S2& s2, const S3& s3, const S4& s4) : s1_(s1), s2_(s2), s3_(s3), s4_(s4) {}
  template <typename T>
  bool operator()(const T& t) const {
    return s1_(t) || s2_(t) || s3_(t) || s4_(t);
  }

private:
  friend class reco::modules::CombinedEventSetupInit<S1, S2, S3, S4, helpers::NullOrOperand>;
  S1 s1_;
  S2 s2_;
  S3 s3_;
  S4 s4_;
};

#endif