File indexing completed on 2024-04-06 12:01:18
0001 #ifndef RecoAlgos_StatusSelector_h
0002 #define RecoAlgos_StatusSelector_h
0003
0004
0005
0006
0007
0008
0009 #include <vector>
0010 #include <algorithm>
0011
0012 struct StatusSelector {
0013 StatusSelector(const std::vector<int>& status) {
0014 for (std::vector<int>::const_iterator i = status.begin(); i != status.end(); ++i)
0015 status_.push_back(*i);
0016 begin_ = status_.begin();
0017 end_ = status_.end();
0018 }
0019 StatusSelector(const StatusSelector& o) : status_(o.status_), begin_(status_.begin()), end_(status_.end()) {}
0020 StatusSelector& operator=(const StatusSelector& o) = default;
0021 StatusSelector& operator==(const StatusSelector& o) {
0022 *this = o;
0023 return *this;
0024 }
0025 template <typename T>
0026 bool operator()(const T& t) const {
0027 return std::find(begin_, end_, t.status()) != end_;
0028 }
0029
0030 private:
0031 std::vector<int> status_;
0032 std::vector<int>::const_iterator begin_, end_;
0033 };
0034
0035 #endif