Honeycomb  0.1
Component-Model Framework
Public Member Functions | Static Public Attributes | List of all members
honey::BitSet_< Block, Alloc_ > Class Template Reference

A compact array of bits. Dynamic version of std::bitset. More...

#include <BitSet.h>

Public Member Functions

 BitSet_ (szt size=0, bool val=false, const Alloc &a=Alloc())
 Construct array with size number of bits, each initialized to val More...
 
 BitSet_ (const Bytes &bs, const Alloc &a=Alloc())
 Construct from bytes in big-endian bit order (the first index will contain the MSB) More...
 
void resize (szt size, bool val=false)
 Resize array to contain size number of bits, with new bits initialized to val More...
 
void set (szt index)
 Set bit to true. More...
 
void set (szt index, bool val)
 Set bit to value. More...
 
void set ()
 Set all bits to true. More...
 
void reset (szt index)
 Set bit to false. More...
 
void reset ()
 Set all bits false. More...
 
void flip (szt index)
 Flip value of bit. More...
 
void flip ()
 Flip values of all bits. More...
 
bool test (szt index) const
 Get bit value. More...
 
bool all () const
 Test if all bits are true. More...
 
bool any () const
 Test if any bits are true. More...
 
bool none () const
 Test if no bits are true. More...
 
szt count () const
 Count number of true values in bit array. More...
 
szt size () const
 Number of bits in the bit array. More...
 
szt blockCount () const
 Number of blocks that the bit array has been split up into. More...
 
const Block * blocks () const
 Get access to raw blocks that hold the bits. Bit index 0 is the LSB of block 0. More...
 
Block * blocks ()
 
Bytes toBytes () const
 Create Bytes from big-endian bits (the first index contains the MSB) More...
 

Static Public Attributes

static const szt bitsPerBlock = sizeof(Block)*8
 

Detailed Description

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
class honey::BitSet_< Block, Alloc_ >

A compact array of bits. Dynamic version of std::bitset.

Constructor & Destructor Documentation

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
honey::BitSet_< Block, Alloc_ >::BitSet_ ( szt  size = 0,
bool  val = false,
const Alloc &  a = Alloc() 
)
inline

Construct array with size number of bits, each initialized to val

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
honey::BitSet_< Block, Alloc_ >::BitSet_ ( const Bytes bs,
const Alloc &  a = Alloc() 
)
inline

Construct from bytes in big-endian bit order (the first index will contain the MSB)

Member Function Documentation

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
bool honey::BitSet_< Block, Alloc_ >::all ( ) const
inline

Test if all bits are true.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
bool honey::BitSet_< Block, Alloc_ >::any ( ) const
inline

Test if any bits are true.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
szt honey::BitSet_< Block, Alloc_ >::blockCount ( ) const
inline

Number of blocks that the bit array has been split up into.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
const Block* honey::BitSet_< Block, Alloc_ >::blocks ( ) const
inline

Get access to raw blocks that hold the bits. Bit index 0 is the LSB of block 0.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
Block* honey::BitSet_< Block, Alloc_ >::blocks ( )
inline
template<class Block = uint64, class Alloc_ = std::allocator<Block>>
szt honey::BitSet_< Block, Alloc_ >::count ( ) const
inline

Count number of true values in bit array.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
void honey::BitSet_< Block, Alloc_ >::flip ( szt  index)
inline

Flip value of bit.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
void honey::BitSet_< Block, Alloc_ >::flip ( )
inline

Flip values of all bits.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
bool honey::BitSet_< Block, Alloc_ >::none ( ) const
inline

Test if no bits are true.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
void honey::BitSet_< Block, Alloc_ >::reset ( szt  index)
inline

Set bit to false.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
void honey::BitSet_< Block, Alloc_ >::reset ( )
inline

Set all bits false.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
void honey::BitSet_< Block, Alloc_ >::resize ( szt  size,
bool  val = false 
)
inline

Resize array to contain size number of bits, with new bits initialized to val

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
void honey::BitSet_< Block, Alloc_ >::set ( szt  index)
inline

Set bit to true.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
void honey::BitSet_< Block, Alloc_ >::set ( szt  index,
bool  val 
)
inline

Set bit to value.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
void honey::BitSet_< Block, Alloc_ >::set ( )
inline

Set all bits to true.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
szt honey::BitSet_< Block, Alloc_ >::size ( ) const
inline

Number of bits in the bit array.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
bool honey::BitSet_< Block, Alloc_ >::test ( szt  index) const
inline

Get bit value.

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
Bytes honey::BitSet_< Block, Alloc_ >::toBytes ( ) const
inline

Create Bytes from big-endian bits (the first index contains the MSB)

Member Data Documentation

template<class Block = uint64, class Alloc_ = std::allocator<Block>>
const szt honey::BitSet_< Block, Alloc_ >::bitsPerBlock = sizeof(Block)*8
static

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