#include <strbitset.h>
Classes | |
class | index_type |
Public Types | |
typedef std::vector< bool > | bit_vector |
typedef unsigned int | size_t |
typedef std::map< std::string, size_t > | str_index_map |
Public Member Functions | |
size_t | any () const |
returns true if any are set | |
const bit_vector & | bits () const |
give access to the ordered bits | |
void | clear () |
clear the bitset and map | |
size_t | count () const |
returns number of bits set | |
strbitset & | flip (index_type const &i) |
strbitset & | flip () |
flip method of all bits | |
strbitset & | flip (std::string s) |
flip method of one bit | |
size_t | none () const |
returns true if none are set | |
operator bool () const | |
! cast to bool | |
bool | operator! () const |
! Logical negation of bool() | |
bool | operator!= (const strbitset &r) const |
inequality operator | |
bool | operator!= (bool b) const |
inequality operator to bool | |
strbitset & | operator&= (const strbitset &r) |
bitwise and | |
bool | operator== (bool b) const |
equality operator to bool | |
bool | operator== (const strbitset &r) const |
equality operator | |
bit_vector::const_reference | operator[] (index_type const &i) const |
bit_vector::reference | operator[] (const std::string s) |
access method non-const | |
bit_vector::reference | operator[] (index_type const &i) |
bit_vector::const_reference | operator[] (const std::string s) const |
access method const | |
strbitset & | operator^= (const strbitset &r) |
bitwise xor | |
strbitset & | operator|= (const strbitset &r) |
bitwise or | |
strbitset | operator~ () |
logical negation | |
void | print (std::ostream &out) const |
print method | |
void | push_back (std::string s) |
strbitset & | set (bool val=true) |
set method of all bits | |
strbitset & | set (index_type const &i, bool val=true) |
strbitset & | set (std::string s, bool val=true) |
set method of one bit | |
strbitset () | |
constructor: just clears the bitset and map | |
const std::vector< std::string > | strings () const |
give access to the ordered strings | |
bool | test (std::string s) const |
test | |
bool | test (index_type const &i) const |
Private Member Functions | |
size_t | index (std::string s) const |
std::string const & | index (size_t i) const |
Private Attributes | |
bit_vector | bits_ |
the actual bits, indexed by the index in "map_" | |
str_index_map | map_ |
map that holds the string-->index map | |
Static Private Attributes | |
static const std::string | dummy_ = std::string("") |
Friends | |
class | index_type |
strbitset | operator& (const strbitset &l, const strbitset &r) |
strbitset | operator^ (const strbitset &l, const strbitset &r) |
strbitset | operator| (const strbitset &l, const strbitset &r) |
Definition at line 24 of file strbitset.h.
typedef std::vector<bool> pat::strbitset::bit_vector |
Definition at line 67 of file strbitset.h.
typedef unsigned int pat::strbitset::size_t |
Definition at line 65 of file strbitset.h.
typedef std::map<std::string, size_t> pat::strbitset::str_index_map |
Definition at line 66 of file strbitset.h.
pat::strbitset::strbitset | ( | ) | [inline] |
constructor: just clears the bitset and map
Definition at line 70 of file strbitset.h.
References clear().
{ clear(); }
size_t pat::strbitset::any | ( | ) | const [inline] |
const bit_vector& pat::strbitset::bits | ( | ) | const [inline] |
give access to the ordered bits
Definition at line 340 of file strbitset.h.
References bits_.
{ return bits_; }
void pat::strbitset::clear | ( | void | ) | [inline] |
clear the bitset and map
Definition at line 75 of file strbitset.h.
Referenced by Selector< pat::Electron >::Selector(), and strbitset().
size_t pat::strbitset::count | ( | void | ) | const [inline] |
strbitset& pat::strbitset::flip | ( | ) | [inline] |
strbitset& pat::strbitset::flip | ( | std::string | s | ) | [inline] |
strbitset& pat::strbitset::flip | ( | index_type const & | i | ) | [inline] |
Definition at line 181 of file strbitset.h.
References i.
std::string const& pat::strbitset::index | ( | size_t | i | ) | const [inline, private] |
Definition at line 378 of file strbitset.h.
References gather_cfg::cout, dummy_, f, and map_.
size_t pat::strbitset::index | ( | std::string | s | ) | const [inline, private] |
workhorse: this gets the index of "bits" that is pointed to by the string "s"
Definition at line 368 of file strbitset.h.
References gather_cfg::cout, f, and map_.
Referenced by pat::strbitset::index_type::index_type(), operator[](), and pat::strbitset::index_type::str().
size_t pat::strbitset::none | ( | ) | const [inline] |
returns true if none are set
Definition at line 326 of file strbitset.h.
References any().
{ return !any(); }
pat::strbitset::operator bool | ( | ) | const [inline] |
bool pat::strbitset::operator! | ( | ) | const [inline] |
! Logical negation of bool()
Definition at line 92 of file strbitset.h.
References operator bool().
{ return ! ( operator bool() ); }
bool pat::strbitset::operator!= | ( | const strbitset & | r | ) | const [inline] |
inequality operator
Definition at line 293 of file strbitset.h.
References operator==().
Referenced by operator!=().
{ return ! (operator==(r)); }
bool pat::strbitset::operator!= | ( | bool | b | ) | const [inline] |
inequality operator to bool
Definition at line 298 of file strbitset.h.
References operator!=().
{ return ! ( operator!=(b)); }
bitwise and
Definition at line 198 of file strbitset.h.
References gather_cfg::cout, i, j, combine::key, map_, and AlCaHLTBitMon_QueryRunRegistry::string.
{ if ( map_.size() != r.map_.size() ) { std::cout << "strbitset operator&= : bitsets not the same size" << std::endl; } else { str_index_map::iterator ibegin = map_.begin(), iend = map_.end(), i = ibegin; for ( ; i != iend; ++i ) { std::string key = i->first; str_index_map::const_iterator j = r.map_.find( key ); if ( j == r.map_.end() ) { std::cout << "strbitset operator&= : cannot find key " << key << std::endl; } else { (*this)[key] = (*this)[key] && r[key]; } } } return *this; }
bool pat::strbitset::operator== | ( | bool | b | ) | const [inline] |
equality operator to bool
Definition at line 281 of file strbitset.h.
References b, bits_, and query::result.
bool pat::strbitset::operator== | ( | const strbitset & | r | ) | const [inline] |
equality operator
Definition at line 262 of file strbitset.h.
References gather_cfg::cout, i, j, combine::key, map_, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by operator!=().
{ if ( map_.size() != r.map_.size() ) { std::cout << "strbitset operator&= : bitsets not the same size" << std::endl; } else { str_index_map::const_iterator ibegin = map_.begin(), iend = map_.end(), i = ibegin; for ( ; i != iend; ++i ) { std::string key = i->first; str_index_map::const_iterator j = r.map_.find( key ); if ( j == r.map_.end() ) { std::cout << "strbitset operator&= : cannot find key " << key << std::endl; } else { if ( (*this)[key] != r[key] ) return false; } } } return true; }
bit_vector::reference pat::strbitset::operator[] | ( | const std::string | s | ) | [inline] |
bit_vector::reference pat::strbitset::operator[] | ( | index_type const & | i | ) | [inline] |
Definition at line 138 of file strbitset.h.
References bits_, and pat::strbitset::index_type::i_.
bit_vector::const_reference pat::strbitset::operator[] | ( | const std::string | s | ) | const [inline] |
bit_vector::const_reference pat::strbitset::operator[] | ( | index_type const & | i | ) | const [inline] |
Definition at line 128 of file strbitset.h.
References bits_, and pat::strbitset::index_type::i_.
bitwise xor
Definition at line 239 of file strbitset.h.
References gather_cfg::cout, i, j, combine::key, map_, and AlCaHLTBitMon_QueryRunRegistry::string.
{ if ( map_.size() != r.map_.size() ) { std::cout << "strbitset operator&= : bitsets not the same size" << std::endl; } else { str_index_map::iterator ibegin = map_.begin(), iend = map_.end(), i = ibegin; for ( ; i != iend; ++i ) { std::string key = i->first; str_index_map::const_iterator j = r.map_.find( key ); if ( j == r.map_.end() ) { std::cout << "strbitset operator&= : cannot find key " << key << std::endl; } else { (*this)[key] = ( (*this)[key] || r[key]) && ! ((*this)[key] && r[key]); } } } return *this; }
bitwise or
Definition at line 218 of file strbitset.h.
References gather_cfg::cout, i, j, combine::key, map_, and AlCaHLTBitMon_QueryRunRegistry::string.
{ if ( map_.size() != r.map_.size() ) { std::cout << "strbitset operator&= : bitsets not the same size" << std::endl; } else { str_index_map::iterator ibegin = map_.begin(), iend = map_.end(), i = ibegin; for ( ; i != iend; ++i ) { std::string key = i->first; str_index_map::const_iterator j = r.map_.find( key ); if ( j == r.map_.end() ) { std::cout << "strbitset operator&= : cannot find key " << key << std::endl; } else { (*this)[key] = (*this)[key] || r[key]; } } } return *this; }
strbitset pat::strbitset::operator~ | ( | ) | [inline] |
void pat::strbitset::print | ( | std::ostream & | out | ) | const [inline] |
print method
Definition at line 111 of file strbitset.h.
void pat::strbitset::push_back | ( | std::string | s | ) | [inline] |
adds an item that is indexed by the string. this can then be sorted, cut, whatever, and the index mapping is kept
Definition at line 99 of file strbitset.h.
References bits_, gather_cfg::cout, map_, and alignCSCRings::s.
Referenced by Selector< pat::Electron >::push_back().
strbitset& pat::strbitset::set | ( | bool | val = true | ) | [inline] |
set method of all bits
Definition at line 144 of file strbitset.h.
Referenced by JetIDSelectionFunctor::craft08Cuts(), MuonVPlusJetsIDSelectionFunctor::fall10Cuts(), SimpleJetFilter::filter(), PFJetIDSelectionFunctor::firstDataCuts(), ElectronVPlusJetsIDSelectionFunctor::firstDataCuts(), MuonVPlusJetsIDSelectionFunctor::firstDataCuts(), JetIDSelectionFunctor::fwd09Cuts(), Selector< pat::Electron >::getBitTemplate(), MuonVPlusJetsIDSelectionFunctor::kitQCDCuts(), JetIDStudiesSelector::operator()(), Selector< pat::Electron >::operator()(), WSelector::operator()(), WPlusJetsEventSelector::operator()(), PVSelector::operator()(), JetIDSelectionFunctor::operator()(), MuonVPlusJetsIDSelectionFunctor::spring10Cuts(), SimpleCutBasedElectronIDSelectionFunctor::spring10Variables(), PFMuonSelector::spring11Cuts(), PFElectronSelector::spring11Cuts(), and MuonVPlusJetsIDSelectionFunctor::summer08Cuts().
strbitset& pat::strbitset::set | ( | std::string | s, |
bool | val = true |
||
) | [inline] |
set method of one bit
Definition at line 164 of file strbitset.h.
References alignCSCRings::s.
{ (*this)[s] = val; return *this; }
strbitset& pat::strbitset::set | ( | index_type const & | i, |
bool | val = true |
||
) | [inline] |
const std::vector<std::string> pat::strbitset::strings | ( | ) | const [inline] |
give access to the ordered strings
Definition at line 346 of file strbitset.h.
bool pat::strbitset::test | ( | index_type const & | i | ) | const [inline] |
bool pat::strbitset::test | ( | std::string | s | ) | const [inline] |
test
Definition at line 331 of file strbitset.h.
References alignCSCRings::s.
Referenced by main().
{ return (*this)[s] == true; }
friend class index_type [friend] |
Definition at line 62 of file strbitset.h.
bit_vector pat::strbitset::bits_ [private] |
the actual bits, indexed by the index in "map_"
Definition at line 391 of file strbitset.h.
Referenced by any(), bits(), clear(), count(), flip(), operator bool(), operator==(), operator[](), operator~(), print(), push_back(), set(), and strings().
const std::string strbitset::dummy_ = std::string("") [static, private] |
Definition at line 389 of file strbitset.h.
Referenced by index().
str_index_map pat::strbitset::map_ [private] |
map that holds the string-->index map
Definition at line 390 of file strbitset.h.
Referenced by clear(), index(), operator&=(), operator==(), operator^=(), operator|=(), print(), push_back(), and strings().