spot 2.16
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
spot::bitvect Class Reference

A bit vector. More...

#include <spot/misc/bitvect.hh>

Collaboration diagram for spot::bitvect:

Public Types

typedef unsigned long block_t
 Storage block type.
 

Public Member Functions

 bitvect (const bitvect &other)
 Copy constructor.
 
bitvectclone () const
 Return a heap-allocated copy.
 
void operator delete (void *ptr)
 Custom operator delete for placement-new allocated instances.
 
void make_empty ()
 Reset the size to zero without freeing storage.
 
bitvectoperator= (const bitvect &other)
 Copy-assignment operator.
 
void reserve_blocks (size_t new_block_count)
 
size_t used_blocks () const
 Return the number of blocks currently in use.
 
size_t size () const
 Return the number of bits in the vector.
 
size_t capacity () const
 Return the maximum number of bits the storage can hold.
 
size_t hash () const noexcept
 Return a hash of the bit vector.
 
bool get (size_t pos) const
 Return the value of bit pos.
 
void clear_all ()
 Clear all bits (set them to zero).
 
bool is_fully_clear () const
 Return true iff all bits are zero.
 
bool is_fully_set () const
 Return true iff all bits are set to one.
 
void set_all ()
 Set all bits to one.
 
void flip_all ()
 Flip all bits.
 
void set (size_t pos)
 Set bit at position pos to one.
 
void clear (size_t pos)
 Clear bit at position pos (set it to zero).
 
void flip (size_t pos)
 Flip the bit at position pos.
 
bitvectoperator|= (const bitvect &other)
 In-place bitwise OR with other.
 
bitvectoperator&= (const bitvect &other)
 In-place bitwise AND with other.
 
bitvectadd_common (const bitvect &other1, const bitvect &other2)
 OR into *this the bits common to other1 and other2.
 
bool intersects (const bitvect &other)
 Return true if *this and other share any set bit.
 
bitvectoperator^= (const bitvect &other)
 In-place bitwise XOR with other.
 
bitvectoperator-= (const bitvect &other)
 Clear in *this the bits that are set in other.
 
bool is_subset_of (const bitvect &other) const
 Return true if every set bit of *this is also set in other.
 
unsigned count () const
 Return the number of set bits (popcount).
 
bool operator== (const bitvect &other) const
 Equality comparison.
 
bool operator!= (const bitvect &other) const
 Inequality comparison.
 
bool operator< (const bitvect &other) const
 Lexicographic less-than comparison.
 
bool operator>= (const bitvect &other) const
 Lexicographic greater-than-or-equal comparison.
 
bool operator> (const bitvect &other) const
 Lexicographic greater-than comparison.
 
bool operator<= (const bitvect &other) const
 Lexicographic less-than-or-equal comparison.
 
template<typename F >
void foreach_set_index (F callback) const
 Call callback with the index of each set bit.
 

Friends

bitvectmake_bitvect (size_t bitcount)
 Allocate a bit-vector of bitcount bits.
 
std::ostream & operator<< (std::ostream &, const bitvect &)
 Print a bitvect.
 
bitvect_arraymake_bitvect_array (size_t bitcount, size_t vectcount)
 Allocate vectcount bit-vectors of bitcount bits.
 

Detailed Description

A bit vector.

Member Typedef Documentation

◆ block_t

typedef unsigned long spot::bitvect::block_t

Storage block type.

Constructor & Destructor Documentation

◆ bitvect()

spot::bitvect::bitvect ( const bitvect other)
inline

Copy constructor.

Member Function Documentation

◆ add_common()

bitvect & spot::bitvect::add_common ( const bitvect other1,
const bitvect other2 
)
inline

OR into *this the bits common to other1 and other2.

◆ capacity()

size_t spot::bitvect::capacity ( ) const
inline

Return the maximum number of bits the storage can hold.

◆ clear()

void spot::bitvect::clear ( size_t  pos)
inline

Clear bit at position pos (set it to zero).

◆ clear_all()

void spot::bitvect::clear_all ( )
inline

Clear all bits (set them to zero).

◆ clone()

bitvect * spot::bitvect::clone ( ) const

Return a heap-allocated copy.

◆ count()

unsigned spot::bitvect::count ( ) const
inline

Return the number of set bits (popcount).

◆ flip()

void spot::bitvect::flip ( size_t  pos)
inline

Flip the bit at position pos.

◆ flip_all()

void spot::bitvect::flip_all ( )
inline

Flip all bits.

◆ foreach_set_index()

template<typename F >
void spot::bitvect::foreach_set_index ( F  callback) const
inline

Call callback with the index of each set bit.

◆ get()

bool spot::bitvect::get ( size_t  pos) const
inline

Return the value of bit pos.

◆ hash()

size_t spot::bitvect::hash ( ) const
noexcept

Return a hash of the bit vector.

◆ intersects()

bool spot::bitvect::intersects ( const bitvect other)
inline

Return true if *this and other share any set bit.

◆ is_fully_clear()

bool spot::bitvect::is_fully_clear ( ) const
inline

Return true iff all bits are zero.

◆ is_fully_set()

bool spot::bitvect::is_fully_set ( ) const
inline

Return true iff all bits are set to one.

◆ is_subset_of()

bool spot::bitvect::is_subset_of ( const bitvect other) const
inline

Return true if every set bit of *this is also set in other.

◆ make_empty()

void spot::bitvect::make_empty ( )
inline

Reset the size to zero without freeing storage.

◆ operator delete()

void spot::bitvect::operator delete ( void *  ptr)
inline

Custom operator delete for placement-new allocated instances.

◆ operator!=()

bool spot::bitvect::operator!= ( const bitvect other) const
inline

Inequality comparison.

◆ operator&=()

bitvect & spot::bitvect::operator&= ( const bitvect other)
inline

In-place bitwise AND with other.

◆ operator-=()

bitvect & spot::bitvect::operator-= ( const bitvect other)
inline

Clear in *this the bits that are set in other.

◆ operator<()

bool spot::bitvect::operator< ( const bitvect other) const
inline

Lexicographic less-than comparison.

References used_blocks().

◆ operator<=()

bool spot::bitvect::operator<= ( const bitvect other) const
inline

Lexicographic less-than-or-equal comparison.

◆ operator=()

bitvect & spot::bitvect::operator= ( const bitvect other)
inline

Copy-assignment operator.

References size().

◆ operator==()

bool spot::bitvect::operator== ( const bitvect other) const
inline

Equality comparison.

References used_blocks().

◆ operator>()

bool spot::bitvect::operator> ( const bitvect other) const
inline

Lexicographic greater-than comparison.

◆ operator>=()

bool spot::bitvect::operator>= ( const bitvect other) const
inline

Lexicographic greater-than-or-equal comparison.

◆ operator^=()

bitvect & spot::bitvect::operator^= ( const bitvect other)
inline

In-place bitwise XOR with other.

◆ operator|=()

bitvect & spot::bitvect::operator|= ( const bitvect other)
inline

In-place bitwise OR with other.

◆ reserve_blocks()

void spot::bitvect::reserve_blocks ( size_t  new_block_count)
inline

Grow the bitvector to new_block_count blocks.

This only changes the capacity of the bitvector, not its size.

◆ set()

void spot::bitvect::set ( size_t  pos)
inline

Set bit at position pos to one.

◆ set_all()

void spot::bitvect::set_all ( )
inline

Set all bits to one.

◆ size()

size_t spot::bitvect::size ( ) const
inline

Return the number of bits in the vector.

Referenced by operator=().

◆ used_blocks()

size_t spot::bitvect::used_blocks ( ) const
inline

Return the number of blocks currently in use.

Referenced by operator<(), and operator==().

Friends And Related Symbol Documentation

◆ make_bitvect

bitvect * make_bitvect ( size_t  bitcount)
friend

Allocate a bit-vector of bitcount bits.

The resulting object should be released with delete.

◆ make_bitvect_array

bitvect_array * make_bitvect_array ( size_t  bitcount,
size_t  vectcount 
)
friend

Allocate vectcount bit-vectors of bitcount bits.

The resulting bitvect_array should be released with delete.

◆ operator<<

std::ostream & operator<< ( std::ostream &  ,
const bitvect  
)
friend

Print a bitvect.


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

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.9.8