Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
WAHVector Class Reference

#include <elm/util/WAHVector.h>

Classes

class  Bit
 

Public Types

typedef t::uint32 word_t
 

Public Member Functions

 WAHVector (void)
 
 WAHVector (int _size, bool init=false)
 
 WAHVector (const WAHVector &v)
 
 ~WAHVector (void)
 
bool bit (int index) const
 
bool isEmpty (void) const
 
bool isFull (void) const
 
bool equals (const WAHVector &vec) const
 
bool includes (const WAHVector &vec) const
 
bool includesStrictly (const WAHVector &vec) const
 
int size (void) const
 
int countBits (void) const
 
int countOnes (void) const
 
int countZeroes (void) const
 
void set (int index, bool value)
 
void set (int index)
 
void clear (int index)
 
void set (void)
 
void clear (void)
 
void copy (const WAHVector &v)
 
void applyAnd (const WAHVector &v)
 
WAHVector makeAnd (const WAHVector &v) const
 
void applyOr (const WAHVector &v)
 
WAHVector makeOr (const WAHVector &v) const
 
void applyReset (const WAHVector &v)
 
WAHVector makeReset (const WAHVector &v) const
 
void applyNot (void)
 
WAHVector makeNot (void) const
 
bool operator[] (int i) const
 
Bit operator[] (int i)
 
WAHVector operator~ (void) const
 
WAHVector operator| (const WAHVector &vec) const
 
WAHVector operator& (const WAHVector &vec) const
 
WAHVector operator+ (const WAHVector &vec) const
 
WAHVector operator* (const WAHVector &vec) const
 
WAHVector operator- (const WAHVector &vec) const
 
WAHVectoroperator= (const WAHVector &vec)
 
WAHVectoroperator|= (const WAHVector &vec)
 
WAHVectoroperator&= (const WAHVector &vec)
 
WAHVectoroperator+= (const WAHVector &vec)
 
WAHVectoroperator*= (const WAHVector &vec)
 
WAHVectoroperator-= (const WAHVector &vec)
 
bool operator== (const WAHVector &v)
 
bool operator!= (const WAHVector &v)
 
bool operator< (const WAHVector &vec) const
 
bool operator<= (const WAHVector &vec) const
 
bool operator> (const WAHVector &vec) const
 
bool operator>= (const WAHVector &vec) const
 
void __dump (io::Output &out) const
 
int __size (void) const
 

Detailed Description

WAHVector is an implementation of bit vector (like elm::BitVector) whose tradeoff has been moved towards a more compact internal representation. Algorithms of WAHVector are a C++ adaptation of:

Wu, K., Otoo, E. J., & Shoshani, A. (2002). Compressing bitmap indexes for faster search operations. Proceedings. 14th International Conference on Scientific and Statistical Database Management (pp. 99-108), IEEE, 2002.

Member Typedef Documentation

◆ word_t

typedef t::uint32 word_t

Constructor & Destructor Documentation

◆ WAHVector() [1/3]

WAHVector ( void  )
inline

Referenced by WAHVector::__size().

◆ WAHVector() [2/3]

WAHVector ( int  size,
bool  init = false 
)

Build a bit of the given size bits.

Parameters
sizeSize in bits of the vector.
initInitial value.

References elm::div(), elm::fill(), and WAHVector::size().

◆ WAHVector() [3/3]

WAHVector ( const WAHVector v)

Build a WAHVector by cloning the given one.

Parameters
vVector to clone.

References elm::array::copy().

◆ ~WAHVector()

~WAHVector ( void  )
inline

Member Function Documentation

◆ __dump()

void __dump ( io::Output out) const

References elm::io::hex(), and iter::next().

Referenced by elm::operator<<().

◆ __size()

int __size ( void  ) const
inline

◆ applyAnd()

void applyAnd ( const WAHVector v)
inline

◆ applyNot()

void applyNot ( void  )
inline

◆ applyOr()

void applyOr ( const WAHVector v)
inline

◆ applyReset()

void applyReset ( const WAHVector v)
inline

Referenced by WAHVector::operator-=().

◆ bit()

bool bit ( int  index) const

Test if a bit has for value one.

Parameters
indexIndex of the tested bit.
Returns
Value of the bit.

References elm::mod().

Referenced by WAHVector::Bit::operator bool(), and WAHVector::operator[]().

◆ clear() [1/2]

void clear ( int  index)

Clear a bit.

Parameters
indexIndex of the bit.

References elm::div(), elm::fill(), builder::fix(), elm::lite(), elm::mod(), builder::pushLite(), and builder::pushRaw().

◆ clear() [2/2]

void clear ( void  )

Set all vector bits to 0.

References elm::div(), and elm::fill().

Referenced by WAHVector::set().

◆ copy()

void copy ( const WAHVector v)

Copy the given vector into the current one.

Parameters
vVector to copy.

References elm::array::copy().

Referenced by WAHVector::operator=().

◆ countBits()

int countBits ( void  ) const
inline

Same as countBits().

References WAHVector::countOnes().

◆ countOnes()

int countOnes ( void  ) const

Count the number of bits to 1.

Returns
Number of bits to 1.

References elm::mask(), elm::ones(), and elm::times().

Referenced by WAHVector::countBits(), and WAHVector::countZeroes().

◆ countZeroes()

int countZeroes ( void  ) const
inline

◆ equals()

bool equals ( const WAHVector vec) const

Test if both vectors are equal.

Parameters
vVector to compare with.
Returns
True if both vectors are equal, false else.

Referenced by WAHVector::includesStrictly(), WAHVector::operator!=(), and WAHVector::operator==().

◆ includes()

bool includes ( const WAHVector vec) const

Test if the current vector includes the given one.

Parameters
vecVector to include.
Returns
True if the current vector includes the given one.

References iter::consume(), iter::count(), iter::isFill(), elm::min(), and iter::value().

Referenced by WAHVector::includesStrictly(), WAHVector::operator<=(), and WAHVector::operator>=().

◆ includesStrictly()

bool includesStrictly ( const WAHVector vec) const

Test if the current vector includes strictly the given one.

Parameters
vecVector to include.
Returns
True if the current vector includes the given one.

References WAHVector::equals(), and WAHVector::includes().

Referenced by WAHVector::operator<(), and WAHVector::operator>().

◆ isEmpty()

bool isEmpty ( void  ) const

Test if all bits are at 0

Returns
True if all bits are at 0, false else.

References elm::isZeroes().

◆ isFull()

bool isFull ( void  ) const

Test if all bits are at 1

Returns
True if all bits are at 1, false else.

References elm::isOnes().

◆ makeAnd()

WAHVector makeAnd ( const WAHVector v) const
inline

◆ makeNot()

WAHVector makeNot ( void  ) const
inline

Referenced by WAHVector::operator~().

◆ makeOr()

WAHVector makeOr ( const WAHVector v) const
inline

◆ makeReset()

WAHVector makeReset ( const WAHVector v) const
inline

Referenced by WAHVector::operator-().

◆ operator!=()

bool operator!= ( const WAHVector v)
inline

References WAHVector::equals().

◆ operator&()

WAHVector operator& ( const WAHVector vec) const
inline

References WAHVector::makeAnd().

◆ operator&=()

WAHVector& operator&= ( const WAHVector vec)
inline

References WAHVector::applyAnd().

◆ operator*()

WAHVector operator* ( const WAHVector vec) const
inline

References WAHVector::makeAnd().

◆ operator*=()

WAHVector& operator*= ( const WAHVector vec)
inline

References WAHVector::applyAnd().

◆ operator+()

WAHVector operator+ ( const WAHVector vec) const
inline

References WAHVector::makeOr().

◆ operator+=()

WAHVector& operator+= ( const WAHVector vec)
inline

References WAHVector::applyOr().

◆ operator-()

WAHVector operator- ( const WAHVector vec) const
inline

◆ operator-=()

WAHVector& operator-= ( const WAHVector vec)
inline

◆ operator<()

bool operator< ( const WAHVector vec) const
inline

◆ operator<=()

bool operator<= ( const WAHVector vec) const
inline

References WAHVector::includes().

◆ operator=()

WAHVector& operator= ( const WAHVector vec)
inline

References WAHVector::copy().

◆ operator==()

bool operator== ( const WAHVector v)
inline

References WAHVector::equals().

◆ operator>()

bool operator> ( const WAHVector vec) const
inline

◆ operator>=()

bool operator>= ( const WAHVector vec) const
inline

References WAHVector::includes().

◆ operator[]() [1/2]

Bit operator[] ( int  i)
inline

◆ operator[]() [2/2]

bool operator[] ( int  i) const
inline

References WAHVector::bit().

◆ operator|()

WAHVector operator| ( const WAHVector vec) const
inline

References WAHVector::makeOr().

◆ operator|=()

WAHVector& operator|= ( const WAHVector vec)
inline

References WAHVector::applyOr().

◆ operator~()

WAHVector operator~ ( void  ) const
inline

References WAHVector::makeNot().

◆ set() [1/3]

void set ( int  index)

int WAHVector::countZeroes(void) const; Count the number of zeroes in the bit vector.

Returns
Number of zeroes. Set a bit.
Parameters
indexIndex of the bit.

References elm::div(), elm::fill(), builder::fix(), elm::lite(), elm::mod(), builder::pushLite(), and builder::pushRaw().

◆ set() [2/3]

void set ( int  index,
bool  value 
)
inline

◆ set() [3/3]

void set ( void  )

Set all vector bits to 1.

References elm::div(), and elm::fill().

◆ size()

int size ( void  ) const

Compute the number of bits in the vector.

Returns
Number of bits.

References elm::times().

Referenced by WAHVector::countZeroes(), and WAHVector::WAHVector().


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