herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
exsample::bit_container< bits > Struct Template Reference

Fixed-size, packed vector of bools. More...

#include <utility.h>

Inheritance diagram for exsample::bit_container< bits >:

Public Types

enum  { n_bits = bits , uint_bits = CHAR_BIT * sizeof(unsigned long) , n_segments = bits / uint_bits + static_binary<bits % uint_bits>::value }
 

Public Member Functions

 bit_container ()
 the default constructor
 
void reset ()
 put all values to false
 
bool operator== (const bit_container &x) const
 compare for equality
 
bool operator< (const bit_container &x) const
 compare for ordering
 
void bit (unsigned long k, bool value)
 set the k'th bit
 
bool bit (unsigned long k) const
 get the k'th bit
 
template<class OStream >
void dump (OStream &os) const
 print to ostream
 
template<class OStream >
void put (OStream &os) const
 put to ostream
 
template<class IStream >
void get (IStream &is)
 get from istream
 

Private Attributes

unsigned long segments [n_segments]
 segments needed to keep the hash value
 

Detailed Description

template<unsigned long bits>
struct exsample::bit_container< bits >

Fixed-size, packed vector of bools.

Definition at line 55 of file utility.h.

Member Enumeration Documentation

◆ anonymous enum

template<unsigned long bits>
anonymous enum
Enumerator
n_bits 

the number of bits contained

uint_bits 

the number of bits fitting in a unsigned long

n_segments 

the number of unsigned long segments needed

Definition at line 57 of file utility.h.

Constructor & Destructor Documentation

◆ bit_container()

template<unsigned long bits>
exsample::bit_container< bits >::bit_container ( )
inline

the default constructor

Definition at line 68 of file utility.h.

References exsample::bit_container< bits >::n_segments, and exsample::bit_container< bits >::segments.

Member Function Documentation

◆ bit() [1/2]

template<unsigned long bits>
bool exsample::bit_container< bits >::bit ( unsigned long  k) const
inline

◆ bit() [2/2]

template<unsigned long bits>
void exsample::bit_container< bits >::bit ( unsigned long  k,
bool  value 
)
inline

◆ dump()

template<unsigned long bits>
template<class OStream >
void exsample::bit_container< bits >::dump ( OStream &  os) const
inline

print to ostream

Definition at line 112 of file utility.h.

References exsample::bit_container< bits >::n_segments, and exsample::bit_container< bits >::segments.

◆ get()

template<unsigned long bits>
template<class IStream >
void exsample::bit_container< bits >::get ( IStream &  is)
inline

get from istream

Definition at line 128 of file utility.h.

References exsample::bit_container< bits >::n_segments, and exsample::bit_container< bits >::segments.

◆ operator<()

template<unsigned long bits>
bool exsample::bit_container< bits >::operator< ( const bit_container< bits > &  x) const
inline

compare for ordering

Definition at line 88 of file utility.h.

References exsample::bit_container< bits >::n_segments, and exsample::bit_container< bits >::segments.

◆ operator==()

template<unsigned long bits>
bool exsample::bit_container< bits >::operator== ( const bit_container< bits > &  x) const
inline

compare for equality

Definition at line 80 of file utility.h.

References exsample::bit_container< bits >::n_segments, and exsample::bit_container< bits >::segments.

◆ put()

template<unsigned long bits>
template<class OStream >
void exsample::bit_container< bits >::put ( OStream &  os) const
inline

◆ reset()

template<unsigned long bits>
void exsample::bit_container< bits >::reset ( )
inline

put all values to false

Definition at line 74 of file utility.h.

References exsample::bit_container< bits >::n_segments, and exsample::bit_container< bits >::segments.

Member Data Documentation

◆ segments


The documentation for this struct was generated from the following file: