CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends
pat::strbitset Class Reference

#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 More...
 
const bit_vectorbits () const
 give access to the ordered bits More...
 
void clear ()
 clear the bitset and map More...
 
size_t count () const
 returns number of bits set More...
 
strbitsetflip ()
 flip method of all bits More...
 
strbitsetflip (std::string s)
 flip method of one bit More...
 
strbitsetflip (index_type const &i)
 
size_t none () const
 returns true if none are set More...
 
 operator bool () const
 ! cast to bool More...
 
bool operator! () const
 ! Logical negation of bool() More...
 
bool operator!= (const strbitset &r) const
 inequality operator More...
 
bool operator!= (bool b) const
 inequality operator to bool More...
 
strbitsetoperator&= (const strbitset &r)
 bitwise and More...
 
bool operator== (const strbitset &r) const
 equality operator More...
 
bool operator== (bool b) const
 equality operator to bool More...
 
bit_vector::const_reference operator[] (const std::string s) const
 access method const More...
 
bit_vector::const_reference operator[] (index_type const &i) const
 
bit_vector::reference operator[] (const std::string s)
 access method non-const More...
 
bit_vector::reference operator[] (index_type const &i)
 
strbitsetoperator^= (const strbitset &r)
 bitwise xor More...
 
strbitsetoperator|= (const strbitset &r)
 bitwise or More...
 
strbitset operator~ ()
 logical negation More...
 
void print (std::ostream &out) const
 print method More...
 
void push_back (std::string s)
 
strbitsetset (bool val=true)
 set method of all bits More...
 
strbitsetset (std::string s, bool val=true)
 set method of one bit More...
 
strbitsetset (index_type const &i, bool val=true)
 
 strbitset ()
 constructor: just clears the bitset and map More...
 
const std::vector< std::string > strings () const
 give access to the ordered strings More...
 
bool test (std::string s) const
 test More...
 
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_" More...
 
str_index_map map_
 map that holds the string–>index map More...
 

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)
 

Detailed Description

Definition at line 24 of file strbitset.h.

Member Typedef Documentation

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.

Constructor & Destructor Documentation

pat::strbitset::strbitset ( )
inline

constructor: just clears the bitset and map

Definition at line 70 of file strbitset.h.

Member Function Documentation

size_t pat::strbitset::any ( ) const
inline

returns true if any are set

Definition at line 316 of file strbitset.h.

const bit_vector& pat::strbitset::bits ( ) const
inline

give access to the ordered bits

Definition at line 340 of file strbitset.h.

void pat::strbitset::clear ( void  )
inline

clear the bitset and map

Definition at line 75 of file strbitset.h.

size_t pat::strbitset::count ( void  ) const
inline

returns number of bits set

Definition at line 303 of file strbitset.h.

strbitset& pat::strbitset::flip ( )
inline

flip method of all bits

Definition at line 154 of file strbitset.h.

strbitset& pat::strbitset::flip ( std::string  s)
inline

flip method of one bit

Definition at line 176 of file strbitset.h.

strbitset& pat::strbitset::flip ( index_type const &  i)
inline

Definition at line 181 of file strbitset.h.

size_t pat::strbitset::index ( std::string  s) const
inlineprivate

workhorse: this gets the index of "bits" that is pointed to by the string "s"

Definition at line 368 of file strbitset.h.

std::string const& pat::strbitset::index ( size_t  i) const
inlineprivate

Definition at line 378 of file strbitset.h.

size_t pat::strbitset::none ( ) const
inline

returns true if none are set

Definition at line 326 of file strbitset.h.

pat::strbitset::operator bool ( ) const
inline

! cast to bool

Definition at line 81 of file strbitset.h.

bool pat::strbitset::operator! ( ) const
inline

! Logical negation of bool()

Definition at line 92 of file strbitset.h.

bool pat::strbitset::operator!= ( const strbitset r) const
inline

inequality operator

Definition at line 293 of file strbitset.h.

bool pat::strbitset::operator!= ( bool  b) const
inline

inequality operator to bool

Definition at line 298 of file strbitset.h.

strbitset& pat::strbitset::operator&= ( const strbitset r)
inline

bitwise and

Definition at line 198 of file strbitset.h.

bool pat::strbitset::operator== ( const strbitset r) const
inline

equality operator

Definition at line 262 of file strbitset.h.

bool pat::strbitset::operator== ( bool  b) const
inline

equality operator to bool

Definition at line 281 of file strbitset.h.

bit_vector::const_reference pat::strbitset::operator[] ( const std::string  s) const
inline

access method const

Definition at line 123 of file strbitset.h.

bit_vector::const_reference pat::strbitset::operator[] ( index_type const &  i) const
inline

Definition at line 128 of file strbitset.h.

bit_vector::reference pat::strbitset::operator[] ( const std::string  s)
inline

access method non-const

Definition at line 133 of file strbitset.h.

bit_vector::reference pat::strbitset::operator[] ( index_type const &  i)
inline

Definition at line 138 of file strbitset.h.

strbitset& pat::strbitset::operator^= ( const strbitset r)
inline

bitwise xor

Definition at line 239 of file strbitset.h.

strbitset& pat::strbitset::operator|= ( const strbitset r)
inline

bitwise or

Definition at line 218 of file strbitset.h.

strbitset pat::strbitset::operator~ ( )
inline

logical negation

Definition at line 187 of file strbitset.h.

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.

strbitset& pat::strbitset::set ( bool  val = true)
inline
strbitset& pat::strbitset::set ( std::string  s,
bool  val = true 
)
inline

set method of one bit

Definition at line 164 of file strbitset.h.

strbitset& pat::strbitset::set ( index_type const &  i,
bool  val = true 
)
inline

Definition at line 169 of file strbitset.h.

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 ( std::string  s) const
inline

test

Definition at line 331 of file strbitset.h.

bool pat::strbitset::test ( index_type const &  i) const
inline

Definition at line 335 of file strbitset.h.

Friends And Related Function Documentation

friend class index_type
friend

Definition at line 62 of file strbitset.h.

strbitset operator& ( const strbitset l,
const strbitset r 
)
friend
strbitset operator^ ( const strbitset l,
const strbitset r 
)
friend
strbitset operator| ( const strbitset l,
const strbitset r 
)
friend

Member Data Documentation

bit_vector pat::strbitset::bits_
private

the actual bits, indexed by the index in "map_"

Definition at line 391 of file strbitset.h.

const std::string strbitset::dummy_ = std::string("")
staticprivate

Definition at line 389 of file strbitset.h.

str_index_map pat::strbitset::map_
private

map that holds the string–>index map

Definition at line 390 of file strbitset.h.