Galois
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
galois::DynamicBitSet Class Reference

Concurrent dynamically allocated bitset. More...

#include <DynamicBitset.h>

Public Types

using tt_is_copyable = int
 this is defined to More...
 

Public Member Functions

 DynamicBitSet ()
 Constructor which initializes to an empty bitset. More...
 
const auto & get_vec () const
 Returns the underlying bitset representation to the user. More...
 
auto & get_vec ()
 Returns the underlying bitset representation to the user. More...
 
void resize (uint64_t n)
 Resizes the bitset. More...
 
void reserve (uint64_t n)
 Reserves capacity for the bitset. More...
 
size_t size () const
 Gets the size of the bitset. More...
 
void reset ()
 Gets the space taken by the bitset. More...
 
void reset (size_t begin, size_t end)
 Unset a range of bits given an inclusive range. More...
 
bool test (size_t index) const
 Check a bit to see if it is currently set. More...
 
bool set (size_t index)
 Set a bit in the bitset. More...
 
bool reset (size_t index)
 Reset a bit in the bitset. More...
 
void bitwise_or (const DynamicBitSet &other)
 
void bitwise_and (const DynamicBitSet &other)
 Does an IN-PLACE bitwise and of this bitset and another bitset. More...
 
void bitwise_and (const DynamicBitSet &other1, const DynamicBitSet &other2)
 Does an IN-PLACE bitwise and of 2 passed in bitsets and saves to this bitset. More...
 
void bitwise_xor (const DynamicBitSet &other)
 Does an IN-PLACE bitwise xor of this bitset and another bitset. More...
 
void bitwise_xor (const DynamicBitSet &other1, const DynamicBitSet &other2)
 Does an IN-PLACE bitwise and of 2 passed in bitsets and saves to this bitset. More...
 
uint64_t count () const
 Count how many bits are set in the bitset. More...
 
std::vector< uint32_t > getOffsets () const
 Returns a vector containing the set bits in this bitset in order from left to right. More...
 

Protected Attributes

galois::PODResizeableArray
< galois::CopyableAtomic
< uint64_t > > 
bitvec
 
size_t num_bits
 

Static Protected Attributes

static constexpr uint32_t bits_uint64 = sizeof(uint64_t) * CHAR_BIT
 

Detailed Description

Concurrent dynamically allocated bitset.

Member Typedef Documentation

this is defined to

Constructor & Destructor Documentation

galois::DynamicBitSet::DynamicBitSet ( )
inline

Constructor which initializes to an empty bitset.

Member Function Documentation

void galois::DynamicBitSet::bitwise_and ( const DynamicBitSet other)
inline

Does an IN-PLACE bitwise and of this bitset and another bitset.

Parameters
otherOther bitset to do bitwise and with
void galois::DynamicBitSet::bitwise_and ( const DynamicBitSet other1,
const DynamicBitSet other2 
)
inline

Does an IN-PLACE bitwise and of 2 passed in bitsets and saves to this bitset.

Parameters
other1Bitset to and with other 2
other2Bitset to and with other 1
void galois::DynamicBitSet::bitwise_or ( const DynamicBitSet other)
inline
void galois::DynamicBitSet::bitwise_xor ( const DynamicBitSet other)
inline

Does an IN-PLACE bitwise xor of this bitset and another bitset.

Parameters
otherOther bitset to do bitwise xor with
void galois::DynamicBitSet::bitwise_xor ( const DynamicBitSet other1,
const DynamicBitSet other2 
)
inline

Does an IN-PLACE bitwise and of 2 passed in bitsets and saves to this bitset.

Parameters
other1Bitset to xor with other 2
other2Bitset to xor with other 1
uint64_t galois::DynamicBitSet::count ( ) const
inline

Count how many bits are set in the bitset.

Returns
number of set bits in the bitset
const auto& galois::DynamicBitSet::get_vec ( ) const
inline

Returns the underlying bitset representation to the user.

Returns
constant reference vector of copyable atomics that represents the bitset
auto& galois::DynamicBitSet::get_vec ( )
inline

Returns the underlying bitset representation to the user.

Returns
reference to vector of copyable atomics that represents the bitset
std::vector<uint32_t> galois::DynamicBitSet::getOffsets ( ) const
inline

Returns a vector containing the set bits in this bitset in order from left to right.

Do NOT call in a parallel region as it uses galois::on_each.

Returns
vector with offsets into set bits
void galois::DynamicBitSet::reserve ( uint64_t  n)
inline

Reserves capacity for the bitset.

Parameters
nSize to reserve the capacity of the bitset to
void galois::DynamicBitSet::reset ( )
inline

Gets the space taken by the bitset.

Returns
the space in bytes taken by this bitset Unset every bit in the bitset.
void galois::DynamicBitSet::reset ( size_t  begin,
size_t  end 
)
inline

Unset a range of bits given an inclusive range.

Parameters
beginfirst bit in range to reset
endlast bit in range to reset
bool galois::DynamicBitSet::reset ( size_t  index)
inline

Reset a bit in the bitset.

Parameters
indexBit to reset
Returns
the old value
void galois::DynamicBitSet::resize ( uint64_t  n)
inline

Resizes the bitset.

Parameters
nSize to change the bitset to
bool galois::DynamicBitSet::set ( size_t  index)
inline

Set a bit in the bitset.

Parameters
indexBit to set
Returns
the old value
size_t galois::DynamicBitSet::size ( ) const
inline

Gets the size of the bitset.

Returns
The number of bits held by the bitset
bool galois::DynamicBitSet::test ( size_t  index) const
inline

Check a bit to see if it is currently set.

Using this is recommeneded only if set() and reset() are not being used in that parallel section/phase

Parameters
indexBit to check to see if set
Returns
true if index is set

Member Data Documentation

constexpr uint32_t galois::DynamicBitSet::bits_uint64 = sizeof(uint64_t) * CHAR_BIT
staticprotected
galois::PODResizeableArray<galois::CopyableAtomic<uint64_t> > galois::DynamicBitSet::bitvec
protected
size_t galois::DynamicBitSet::num_bits
protected

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