MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::TypedBitSet< I > Class Template Reference

container of bits representing specific indices (faces, verts or edges) More...

#include <MRBitSet.h>

+ Inheritance diagram for MR::TypedBitSet< I >:

Public Types

using IndexType = I
 
- Public Types inherited from MR::BitSet
using base = boost::dynamic_bitset<std::uint64_t>
 
using IndexType = size_t
 

Public Member Functions

 TypedBitSet (const BitSet &src)
 copies all bits from another BitSet (or a descending class, e.g. TypedBitSet)
 
 TypedBitSet (BitSet &&src)
 moves all bits from another BitSet (or a descending class, e.g. TypedBitSet)
 
TypedBitSetset (IndexType n, size_type len, bool val)
 
TypedBitSetset (IndexType n, bool val=true)
 
TypedBitSetset ()
 
TypedBitSetreset (IndexType n, size_type len)
 
TypedBitSetreset (IndexType n)
 
TypedBitSetreset ()
 
TypedBitSetflip (IndexType n, size_type len)
 
TypedBitSetflip (IndexType n)
 
TypedBitSetflip ()
 
bool test (IndexType n) const
 
bool test_set (IndexType n, bool val=true)
 
MR_BIND_IGNORE reference operator[] (IndexType pos)
 
bool operator[] (IndexType pos) const
 
IndexType find_first () const
 
IndexType find_next (IndexType pos) const
 
IndexType find_last () const
 
IndexType nthSetBit (size_t n) const
 returns the location of nth set bit (where the first bit corresponds to n=0) or IndexType(npos) if there are less bit set
 
TypedBitSetoperator&= (const TypedBitSet &b)
 
TypedBitSetoperator|= (const TypedBitSet &b)
 
TypedBitSetoperator^= (const TypedBitSet &b)
 
TypedBitSetoperator-= (const TypedBitSet &b)
 
TypedBitSetsubtract (const TypedBitSet &b, int bShiftInBlocks)
 subtracts b from this, considering that bits in b are shifted right on bShiftInBlocks*bits_per_block
 
bool is_subset_of (const TypedBitSet &a) const
 returns true if, for every bit that is set in this bitset, the corresponding bit in bitset a is also set. Otherwise this function returns false.
 
bool is_proper_subset_of (const TypedBitSet &a) const
 returns true if, for every bit that is set in this bitset, the corresponding bit in bitset a is also set and if this->count() < a.count(). Otherwise this function returns false.
 
bool intersects (const TypedBitSet &a) const
 returns true if, there is a bit which is set in this bitset, such that the corresponding bit in bitset a is also set. Otherwise this function returns false.
 
void autoResizeSet (IndexType pos, size_type len, bool val=true)
 
void autoResizeSet (IndexType pos, bool val=true)
 
bool autoResizeTestSet (IndexType pos, bool val=true)
 
template<typename M >
TypedBitSet getMapping (const M &map) const
 constructs another bit set from this where every set bit index is transformed using given map
 
TypedBitSet getMapping (const Vector< IndexType, IndexType > &map) const
 
TypedBitSet getMapping (const BMap< IndexType, IndexType > &map) const
 
TypedBitSet getMapping (const HashMap< IndexType, IndexType > &map) const
 
template<typename M >
TypedBitSet getMapping (const M &map, size_t resSize) const
 this is a faster version if the result size is known beforehand
 
TypedBitSet getMapping (const Vector< IndexType, IndexType > &map, size_t resSize) const
 
TypedBitSet getMapping (const HashMap< IndexType, IndexType > &map, size_t resSize) const
 
IndexType backId () const
 returns the identifier of the back() element
 
IndexType endId () const
 
template<typename M >
TypedBitSet< I > getMapping (const M &map) const
 
template<typename M >
TypedBitSet< I > getMapping (const M &map, size_t resSize) const
 
- Public Member Functions inherited from MR::BitSet
 BitSet (size_t numBits, bool fillValue)
 creates bitset of given size filled with given value
 
 BitSet (size_t, unsigned long)=delete
 prohibit these constructors inherited from boost::dynamic_bitset, which can initialize only few initial bits
 
template<class T , std::enable_if_t< std::is_arithmetic< T >::value, std::nullptr_t > = nullptr>
 BitSet (T, T)=delete
 
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
 
- Static Public Member Functions inherited from MR::BitSet
static IndexType beginId ()
 [beginId(), endId()) is the range of all bits in the set
 

Friends

TypedBitSet operator& (const TypedBitSet &a, const TypedBitSet &b)
 
TypedBitSet operator| (const TypedBitSet &a, const TypedBitSet &b)
 
TypedBitSet operator^ (const TypedBitSet &a, const TypedBitSet &b)
 
TypedBitSet operator- (const TypedBitSet &a, const TypedBitSet &b)
 

Detailed Description

template<typename I>
class MR::TypedBitSet< I >

container of bits representing specific indices (faces, verts or edges)

Member Typedef Documentation

◆ IndexType

template<typename I >
using MR::TypedBitSet< I >::IndexType = I

Constructor & Destructor Documentation

◆ TypedBitSet() [1/2]

template<typename I >
MR::TypedBitSet< I >::TypedBitSet ( const BitSet & src)
inlineexplicit

copies all bits from another BitSet (or a descending class, e.g. TypedBitSet)

◆ TypedBitSet() [2/2]

template<typename I >
MR::TypedBitSet< I >::TypedBitSet ( BitSet && src)
inlineexplicit

moves all bits from another BitSet (or a descending class, e.g. TypedBitSet)

Member Function Documentation

◆ autoResizeSet() [1/2]

template<typename I >
void MR::TypedBitSet< I >::autoResizeSet ( IndexType pos,
bool val = true )
inline

◆ autoResizeSet() [2/2]

template<typename I >
void MR::TypedBitSet< I >::autoResizeSet ( IndexType pos,
size_type len,
bool val = true )
inline

◆ autoResizeTestSet()

template<typename I >
bool MR::TypedBitSet< I >::autoResizeTestSet ( IndexType pos,
bool val = true )
inlinenodiscard

◆ backId()

template<typename I >
IndexType MR::TypedBitSet< I >::backId ( ) const
inlinenodiscard

returns the identifier of the back() element

◆ beginId()

template<typename I >
static IndexType MR::TypedBitSet< I >::beginId ( )
inlinestaticnodiscard

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

◆ endId()

template<typename I >
IndexType MR::TypedBitSet< I >::endId ( ) const
inlinenodiscard

◆ find_first()

template<typename I >
IndexType MR::TypedBitSet< I >::find_first ( ) const
inlinenodiscard

◆ find_last()

template<typename I >
IndexType MR::TypedBitSet< I >::find_last ( ) const
inlinenodiscard

◆ find_next()

template<typename I >
IndexType MR::TypedBitSet< I >::find_next ( IndexType pos) const
inlinenodiscard

◆ flip() [1/3]

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::flip ( )
inline

◆ flip() [2/3]

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::flip ( IndexType n)
inline

◆ flip() [3/3]

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::flip ( IndexType n,
size_type len )
inline

◆ getMapping() [1/7]

template<typename I >
TypedBitSet MR::TypedBitSet< I >::getMapping ( const BMap< IndexType, IndexType > & map) const
inlinenodiscard

◆ getMapping() [2/7]

template<typename I >
TypedBitSet MR::TypedBitSet< I >::getMapping ( const HashMap< IndexType, IndexType > & map) const
inlinenodiscard

◆ getMapping() [3/7]

template<typename I >
TypedBitSet MR::TypedBitSet< I >::getMapping ( const HashMap< IndexType, IndexType > & map,
size_t resSize ) const
inlinenodiscard

◆ getMapping() [4/7]

template<typename I >
template<typename M >
TypedBitSet MR::TypedBitSet< I >::getMapping ( const M & map) const
nodiscard

constructs another bit set from this where every set bit index is transformed using given map

◆ getMapping() [5/7]

template<typename I >
template<typename M >
TypedBitSet MR::TypedBitSet< I >::getMapping ( const M & map,
size_t resSize ) const
nodiscard

this is a faster version if the result size is known beforehand

◆ getMapping() [6/7]

template<typename I >
TypedBitSet MR::TypedBitSet< I >::getMapping ( const Vector< IndexType, IndexType > & map) const
inlinenodiscard

◆ getMapping() [7/7]

template<typename I >
TypedBitSet MR::TypedBitSet< I >::getMapping ( const Vector< IndexType, IndexType > & map,
size_t resSize ) const
inlinenodiscard

◆ intersects()

template<typename I >
bool MR::TypedBitSet< I >::intersects ( const TypedBitSet< I > & a) const
inline

returns true if, there is a bit which is set in this bitset, such that the corresponding bit in bitset a is also set. Otherwise this function returns false.

◆ is_proper_subset_of()

template<typename I >
bool MR::TypedBitSet< I >::is_proper_subset_of ( const TypedBitSet< I > & a) const
inline

returns true if, for every bit that is set in this bitset, the corresponding bit in bitset a is also set and if this->count() < a.count(). Otherwise this function returns false.

◆ is_subset_of()

template<typename I >
bool MR::TypedBitSet< I >::is_subset_of ( const TypedBitSet< I > & a) const
inline

returns true if, for every bit that is set in this bitset, the corresponding bit in bitset a is also set. Otherwise this function returns false.

◆ nthSetBit()

template<typename I >
IndexType MR::TypedBitSet< I >::nthSetBit ( size_t n) const
inlinenodiscard

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

◆ operator&=()

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::operator&= ( const TypedBitSet< I > & b)
inline

◆ operator-=()

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::operator-= ( const TypedBitSet< I > & b)
inline

◆ operator[]() [1/2]

template<typename I >
MR_BIND_IGNORE reference MR::TypedBitSet< I >::operator[] ( IndexType pos)
inlinenodiscard

◆ operator[]() [2/2]

template<typename I >
bool MR::TypedBitSet< I >::operator[] ( IndexType pos) const
inlinenodiscard

◆ operator^=()

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::operator^= ( const TypedBitSet< I > & b)
inline

◆ operator|=()

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::operator|= ( const TypedBitSet< I > & b)
inline

◆ reset() [1/3]

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::reset ( )
inline

◆ reset() [2/3]

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::reset ( IndexType n)
inline

◆ reset() [3/3]

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::reset ( IndexType n,
size_type len )
inline

◆ set() [1/3]

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::set ( )
inline

◆ set() [2/3]

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::set ( IndexType n,
bool val = true )
inline

◆ set() [3/3]

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::set ( IndexType n,
size_type len,
bool val )
inline

◆ subtract()

template<typename I >
TypedBitSet & MR::TypedBitSet< I >::subtract ( const TypedBitSet< I > & b,
int bShiftInBlocks )
inline

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

◆ test()

template<typename I >
bool MR::TypedBitSet< I >::test ( IndexType n) const
inlinenodiscard

◆ test_set()

template<typename I >
bool MR::TypedBitSet< I >::test_set ( IndexType n,
bool val = true )
inlinenodiscard

Friends And Related Symbol Documentation

◆ operator&

template<typename I >
TypedBitSet operator& ( const TypedBitSet< I > & a,
const TypedBitSet< I > & b )
friend

◆ operator-

template<typename I >
TypedBitSet operator- ( const TypedBitSet< I > & a,
const TypedBitSet< I > & b )
friend

◆ operator^

template<typename I >
TypedBitSet operator^ ( const TypedBitSet< I > & a,
const TypedBitSet< I > & b )
friend

◆ operator|

template<typename I >
TypedBitSet operator| ( const TypedBitSet< I > & a,
const TypedBitSet< I > & b )
friend

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