Zero  0.1.0
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
w_bitvector_t< BIT_COUNT > Class Template Reference

Templated bitmap for arbitrary size in bits. More...

#include <w_bitvector.h>

Public Types

enum  { BITS = BIT_COUNT }
 
typedef uint64_t Word
 

Public Member Functions

 w_bitvector_t ()
 
int num_bits () const
 return size in bits More...
 
int num_words () const
 return size in words (unsigned long) More...
 
bool overlap (w_bitvector_t &merged, const w_bitvector_t &other) const
 OR-together and return merged vector. More...
 
int words_overlap (w_bitvector_t &merged, const w_bitvector_t &other) const
 OR-together and return merged vector. More...
 
bool contains (const w_bitvector_t &subset) const
 
void merge (const w_bitvector_t &added)
 
ostream & print (ostream &o) const
 
void clear ()
 clear all bits More...
 
bool is_empty () const
 true if all bits are clear More...
 
int num_bits_set () const
 
bool is_full () const
 true if all bits are set More...
 
void copy (const w_bitvector_t &other)
 copy operator More...
 
Word get_bit (Word idx) const
 Should use is_set() More...
 
bool is_set (Word idx) const
 true if bit at index idx is set More...
 
void set_bit (Word idx)
 set bit at index idx More...
 
void clear_bit (Word idx)
 clear bit at index idx More...
 

Private Types

enum  { BITS_PER_WORD = 8 * sizeof(Word) }
 
enum  { WORDS = (BITS + BITS_PER_WORD - 1) / BITS_PER_WORD }
 

Private Attributes

uint64_t data [WORDS]
 

Detailed Description

template<int BIT_COUNT>
class w_bitvector_t< BIT_COUNT >

Templated bitmap for arbitrary size in bits.

Member Typedef Documentation

§ Word

template<int BIT_COUNT>
typedef uint64_t w_bitvector_t< BIT_COUNT >::Word

Member Enumeration Documentation

§ anonymous enum

template<int BIT_COUNT>
anonymous enum
Enumerator
BITS 

§ anonymous enum

template<int BIT_COUNT>
anonymous enum
private
Enumerator
BITS_PER_WORD 

§ anonymous enum

template<int BIT_COUNT>
anonymous enum
private
Enumerator
WORDS 

Constructor & Destructor Documentation

§ w_bitvector_t()

template<int BIT_COUNT>
w_bitvector_t< BIT_COUNT >::w_bitvector_t ( )
inline

Member Function Documentation

§ clear()

template<int BIT_COUNT>
void w_bitvector_t< BIT_COUNT >::clear ( )
inline

clear all bits

§ clear_bit()

template<int BIT_COUNT>
void w_bitvector_t< BIT_COUNT >::clear_bit ( Word  idx)
inline

clear bit at index idx

§ contains()

template<int BIT_COUNT>
bool w_bitvector_t< BIT_COUNT >::contains ( const w_bitvector_t< BIT_COUNT > &  subset) const
inline

Returns if all ON-bits in subset are also ON in this bitmap.

§ copy()

template<int BIT_COUNT>
void w_bitvector_t< BIT_COUNT >::copy ( const w_bitvector_t< BIT_COUNT > &  other)
inline

copy operator

§ get_bit()

template<int BIT_COUNT>
Word w_bitvector_t< BIT_COUNT >::get_bit ( Word  idx) const
inline

Should use is_set()

§ is_empty()

template<int BIT_COUNT>
bool w_bitvector_t< BIT_COUNT >::is_empty ( void  ) const
inline

true if all bits are clear

§ is_full()

template<int BIT_COUNT>
bool w_bitvector_t< BIT_COUNT >::is_full ( ) const
inline

true if all bits are set

§ is_set()

template<int BIT_COUNT>
bool w_bitvector_t< BIT_COUNT >::is_set ( Word  idx) const
inline

true if bit at index idx is set

§ merge()

template<int BIT_COUNT>
void w_bitvector_t< BIT_COUNT >::merge ( const w_bitvector_t< BIT_COUNT > &  added)
inline

Updates this bitmap by taking OR with the given bitmap.

§ num_bits()

template<int BIT_COUNT>
int w_bitvector_t< BIT_COUNT >::num_bits ( ) const
inline

return size in bits

§ num_bits_set()

template<int BIT_COUNT>
int w_bitvector_t< BIT_COUNT >::num_bits_set ( ) const
inline

§ num_words()

template<int BIT_COUNT>
int w_bitvector_t< BIT_COUNT >::num_words ( ) const
inline

return size in words (unsigned long)

§ overlap()

template<int BIT_COUNT>
bool w_bitvector_t< BIT_COUNT >::overlap ( w_bitvector_t< BIT_COUNT > &  merged,
const w_bitvector_t< BIT_COUNT > &  other 
) const
inline

OR-together and return merged vector.

OR-together this bitmap with other bitmap and stuff result into merged. Return true if this entire bitmap is found in the other.

§ print()

template<int BIT_COUNT>
ostream& w_bitvector_t< BIT_COUNT >::print ( ostream &  o) const
inline

§ set_bit()

template<int BIT_COUNT>
void w_bitvector_t< BIT_COUNT >::set_bit ( Word  idx)
inline

set bit at index idx

§ words_overlap()

template<int BIT_COUNT>
int w_bitvector_t< BIT_COUNT >::words_overlap ( w_bitvector_t< BIT_COUNT > &  merged,
const w_bitvector_t< BIT_COUNT > &  other 
) const
inline

OR-together and return merged vector.

OR-together this bitmap with other bitmap and stuff result into merged. Return the number of words in which this bitmap is found in the other bitmap.

Member Data Documentation

§ data

template<int BIT_COUNT>
uint64_t w_bitvector_t< BIT_COUNT >::data[WORDS]
private

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