Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:14

0001 #ifndef RecoAlgos_StatusSelector_h
0002 #define RecoAlgos_StatusSelector_h
0003 /* \class StatusSelector
0004  *
0005  * \author Luca Lista, INFN
0006  *
0007  * $Id: StatusSelector.h,v 1.3 2007/06/18 18:33:54 llista Exp $
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) {
0021     *this = o;
0022     return *this;
0023   }
0024   template <typename T>
0025   bool operator()(const T& t) const {
0026     return std::find(begin_, end_, t.status()) != end_;
0027   }
0028 
0029 private:
0030   std::vector<int> status_;
0031   std::vector<int>::const_iterator begin_, end_;
0032 };
0033 
0034 #endif