MeshLib Documentation
Loading...
Searching...
No Matches
MR::BitSet Class Reference

container of bits More...

#include <MRBitSet.h>

+ Inheritance diagram for MR::BitSet:

Public Types

using base = boost::dynamic_bitset<std::uint64_t>
 
using IndexType = size_t
 

Public Member Functions

 BitSet (size_t numBits, bool fillValue)
 creates bitset of given size filled with given value
 
bool test (IndexType n) const
 
bool test_set (IndexType n, bool val=true)
 
BitSetset (IndexType n, size_type len, bool val)
 
BitSetset (IndexType n, bool val=true)
 
BitSetset ()
 
BitSetreset (IndexType n, size_type len)
 
BitSetreset (IndexType n)
 
BitSetreset ()
 
BitSetflip (IndexType n, size_type len)
 
BitSetflip (IndexType n)
 
BitSetflip ()
 
const auto & bits () const
 read-only access to all bits stored as a vector of uint64 blocks
 
MRMESH_API BitSetoperator&= (const BitSet &b)
 
MRMESH_API BitSetoperator|= (const BitSet &b)
 
MRMESH_API BitSetoperator^= (const BitSet &b)
 
MRMESH_API BitSetoperator-= (const BitSet &b)
 
MRMESH_API BitSetsubtract (const BitSet &b, int bShiftInBlocks)
 subtracts b from this, considering that bits in b are shifted right on bShiftInBlocks*bits_per_block
 
MRMESH_API IndexType find_last () const
 return the highest index i such as bit i is set, or npos if *this has no on bits.
 
MRMESH_API size_t nthSetBit (size_t n) const
 returns the location of nth set bit (where the first bit corresponds to n=0) or npos if there are less bit set
 
void resizeWithReserve (size_t newSize)
 doubles reserved memory until resize(newSize) can be done without reallocation
 
void autoResizeSet (size_t pos, size_type len, bool val=true)
 sets elements [pos, pos+len) to given value, adjusting the size of the set to include new elements
 
void autoResizeSet (size_t pos, bool val=true)
 
bool autoResizeTestSet (size_t pos, bool val=true)
 same as autoResizeSet and returns previous value of pos-bit
 
size_t heapBytes () const
 returns the amount of memory this object occupies on heap
 
IndexType backId () const
 returns the identifier of the back() element
 
IndexType endId () const
 

Static Public Member Functions

static IndexType beginId ()
 [beginId(), endId()) is the range of all bits in the set
 

Detailed Description

container of bits

Member Typedef Documentation

◆ base

using MR::BitSet::base = boost::dynamic_bitset<std::uint64_t>

◆ IndexType

using MR::BitSet::IndexType = size_t

Constructor & Destructor Documentation

◆ BitSet()

MR::BitSet::BitSet ( size_t numBits,
bool fillValue )
inlineexplicit

creates bitset of given size filled with given value

Member Function Documentation

◆ autoResizeSet() [1/2]

void MR::BitSet::autoResizeSet ( size_t pos,
bool val = true )
inline

◆ autoResizeSet() [2/2]

void MR::BitSet::autoResizeSet ( size_t pos,
size_type len,
bool val = true )
inline

sets elements [pos, pos+len) to given value, adjusting the size of the set to include new elements

◆ autoResizeTestSet()

bool MR::BitSet::autoResizeTestSet ( size_t pos,
bool val = true )
inlinenodiscard

same as autoResizeSet and returns previous value of pos-bit

◆ backId()

IndexType MR::BitSet::backId ( ) const
inlinenodiscard

returns the identifier of the back() element

◆ beginId()

static IndexType MR::BitSet::beginId ( )
inlinestaticnodiscard

[beginId(), endId()) is the range of all bits in the set

◆ bits()

const auto & MR::BitSet::bits ( ) const
inline

read-only access to all bits stored as a vector of uint64 blocks

◆ endId()

IndexType MR::BitSet::endId ( ) const
inlinenodiscard

◆ find_last()

MRMESH_API IndexType MR::BitSet::find_last ( ) const
nodiscard

return the highest index i such as bit i is set, or npos if *this has no on bits.

◆ flip() [1/3]

BitSet & MR::BitSet::flip ( )
inline

◆ flip() [2/3]

BitSet & MR::BitSet::flip ( IndexType n)
inline

◆ flip() [3/3]

BitSet & MR::BitSet::flip ( IndexType n,
size_type len )
inline

◆ heapBytes()

size_t MR::BitSet::heapBytes ( ) const
inlinenodiscard

returns the amount of memory this object occupies on heap

◆ nthSetBit()

MRMESH_API size_t MR::BitSet::nthSetBit ( size_t n) const
nodiscard

returns the location of nth set bit (where the first bit corresponds to n=0) or npos if there are less bit set

◆ operator&=()

MRMESH_API BitSet & MR::BitSet::operator&= ( const BitSet & b)

◆ operator-=()

MRMESH_API BitSet & MR::BitSet::operator-= ( const BitSet & b)

◆ operator^=()

MRMESH_API BitSet & MR::BitSet::operator^= ( const BitSet & b)

◆ operator|=()

MRMESH_API BitSet & MR::BitSet::operator|= ( const BitSet & b)

◆ reset() [1/3]

BitSet & MR::BitSet::reset ( )
inline

◆ reset() [2/3]

BitSet & MR::BitSet::reset ( IndexType n)
inline

◆ reset() [3/3]

BitSet & MR::BitSet::reset ( IndexType n,
size_type len )
inline

◆ resizeWithReserve()

void MR::BitSet::resizeWithReserve ( size_t newSize)
inline

doubles reserved memory until resize(newSize) can be done without reallocation

◆ set() [1/3]

BitSet & MR::BitSet::set ( )
inline

◆ set() [2/3]

BitSet & MR::BitSet::set ( IndexType n,
bool val = true )
inline

◆ set() [3/3]

BitSet & MR::BitSet::set ( IndexType n,
size_type len,
bool val )
inline

◆ subtract()

MRMESH_API BitSet & MR::BitSet::subtract ( const BitSet & b,
int bShiftInBlocks )

subtracts b from this, considering that bits in b are shifted right on bShiftInBlocks*bits_per_block

◆ test()

bool MR::BitSet::test ( IndexType n) const
inlinenodiscard

◆ test_set()

bool MR::BitSet::test_set ( IndexType n,
bool val = true )
inlinenodiscard

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