![]() |
![]() |
00001 #ifndef RecoAlgos_StatusSelector_h 00002 #define RecoAlgos_StatusSelector_h 00003 /* \class StatusSelector 00004 * 00005 * \author Luca Lista, INFN 00006 * 00007 * $Id: StatusSelector.h,v 1.1 2009/02/24 14:40:26 llista Exp $ 00008 */ 00009 #include <vector> 00010 #include <algorithm> 00011 00012 struct StatusSelector { 00013 StatusSelector( const std::vector<int> & status ) { 00014 for( std::vector<int>::const_iterator i = status.begin(); i != status.end(); ++ i ) 00015 status_.push_back( * i ); 00016 begin_ = status_.begin(); 00017 end_ = status_.end(); 00018 } 00019 StatusSelector( const StatusSelector & o ) : 00020 status_( o.status_ ), begin_( status_.begin() ), end_( status_.end() ) { } 00021 StatusSelector & operator==( const StatusSelector & o ) { 00022 * this = o; return * this; 00023 } 00024 template<typename T> 00025 bool operator()( const T & t ) const { 00026 return std::find( begin_, end_, t.status() ) != end_; 00027 } 00028 private: 00029 std::vector<int> status_; 00030 std::vector<int>::const_iterator begin_, end_; 00031 }; 00032 00033 #endif