Public Member Functions | Friends

graphlab::dense_bitset Class Reference
[GraphLab Utility Classes and Functions]

#include <dense_bitset.hpp>

List of all members.

Public Member Functions

 dense_bitset ()
 Constructs a bitset of 0 length.
 dense_bitset (size_t size)
 Constructs a bitset with 'size' bits. All bits will be cleared.
 dense_bitset (const dense_bitset &db)
 Make a copy of the bitset db.
 ~dense_bitset ()
 destructor
dense_bitsetoperator= (const dense_bitset &db)
 Make a copy of the bitset db.
void resize (size_t n)
void clear ()
 Sets all bits to 0.
void fill ()
 Sets all bits to 1.
void prefetch (uint32_t b) const
 Prefetches the word containing the bit b.
bool get (uint32_t b) const
 Returns the value of the bit b.
bool set_bit (uint32_t b)
 Atomically sets the bit at position b to true returning the old value.
bool set_bit_unsync (uint32_t b)
bool set (uint32_t b, bool value)
 Atomically sets the state of the bit to the new value returning the old value.
bool set_unsync (uint32_t b, bool value)
bool clear_bit (uint32_t b)
 Atomically set the bit at b to false returning the old value.
bool clear_bit_unsync (uint32_t b)
bool first_bit (uint32_t &b)
bool next_bit (uint32_t &b)
size_t size () const
 Returns the number of bits in this bitset.
void save (oarchive &oarc) const
 Serializes this bitset to an archive.
void load (iarchive &iarc)
 Deserializes this bitset from an archive.

Friends

class fixed_dense_bitset

Detailed Description

Implements an atomic dense bitset

Definition at line 33 of file dense_bitset.hpp.


Member Function Documentation

bool graphlab::dense_bitset::clear_bit_unsync ( uint32_t  b  )  [inline]

Clears the state of the bit returning the old value. This version uses a non-atomic set which is faster, but is unsafe if accessed by multiple threads.

Definition at line 152 of file dense_bitset.hpp.

bool graphlab::dense_bitset::first_bit ( uint32_t &  b  )  [inline]

Returns true with b containing the position of the first bit set to true. If such a bit does not exist, this function returns false.

Definition at line 167 of file dense_bitset.hpp.

bool graphlab::dense_bitset::next_bit ( uint32_t &  b  )  [inline]

Where b is a bit index, this function will return in b, the position of the next bit set to true, and return true. If all bits after b are false, this function returns false.

Definition at line 181 of file dense_bitset.hpp.

void graphlab::dense_bitset::resize ( size_t  n  )  [inline]

Resizes the current bitset to hold n bits. Existing bits will not be changed. If the array size is increased, the value of the new bits are undefined

Definition at line 70 of file dense_bitset.hpp.

bool graphlab::dense_bitset::set_bit_unsync ( uint32_t  b  )  [inline]

Set the bit at position b to true returning the old value. Unlike set_bit(), this uses a non-atomic set which is faster, but is unsafe if accessed by multiple threads.

Definition at line 112 of file dense_bitset.hpp.

bool graphlab::dense_bitset::set_unsync ( uint32_t  b,
bool  value 
) [inline]

Set the state of the bit returning the old value. This version uses a non-atomic set which is faster, but is unsafe if accessed by multiple threads.

Definition at line 132 of file dense_bitset.hpp.


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