OpenVDB  11.0.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Mask< LOG2DIM > Class Template Reference

Bit-mask to encode active states and facilitate sequential iterators and a fast codec for I/O compression. More...

#include <nanovdb/NanoVDB.h>

Classes

class  DenseIterator
 
class  Iterator
 

Public Types

using OnIterator = Iterator< true >
 
using OffIterator = Iterator< false >
 

Public Member Functions

uint32_t countOn () const
 Return the total number of set bits in this Mask. More...
 
uint32_t countOn (uint32_t i) const
 Return the number of lower set bits in mask up to but excluding the i'th bit. More...
 
OnIterator beginOn () const
 
OffIterator beginOff () const
 
DenseIterator beginAll () const
 
 Mask ()
 Initialize all bits to zero. More...
 
 Mask (bool on)
 
 Mask (const Mask &other)
 Copy constructor. More...
 
uint64_t * words ()
 Return a pointer to the list of words of the bit mask. More...
 
const uint64_t * words () const
 
template<typename MaskT = Mask>
enable_if<!is_same< MaskT, Mask >::value, Mask & >::type operator= (const MaskT &other)
 Assignment operator that works with openvdb::util::NodeMask. More...
 
Maskoperator= (const Mask &other)
 
bool operator== (const Mask &other) const
 
bool operator!= (const Mask &other) const
 
bool isOn (uint32_t n) const
 Return true if the given bit is set. More...
 
bool isOff (uint32_t n) const
 Return true if the given bit is NOT set. More...
 
bool isOn () const
 Return true if all the bits are set in this Mask. More...
 
bool isOff () const
 Return true if none of the bits are set in this Mask. More...
 
void setOn (uint32_t n)
 Set the specified bit on. More...
 
void setOff (uint32_t n)
 Set the specified bit off. More...
 
void set (uint32_t n, bool on)
 Set the specified bit on or off. More...
 
void setOn ()
 Set all bits on. More...
 
void setOff ()
 Set all bits off. More...
 
void set (bool on)
 Set all bits off. More...
 
void toggle ()
 brief Toggle the state of all bits in the mask More...
 
void toggle (uint32_t n)
 
Maskoperator&= (const Mask &other)
 Bitwise intersection. More...
 
Maskoperator|= (const Mask &other)
 Bitwise union. More...
 
Maskoperator-= (const Mask &other)
 Bitwise difference. More...
 
Maskoperator^= (const Mask &other)
 Bitwise XOR. More...
 
template<bool ON>
uint32_t findFirst () const
 
template<bool ON>
uint32_t findNext (uint32_t start) const
 
template<bool ON>
uint32_t findPrev (uint32_t start) const
 

Static Public Member Functions

static size_t memUsage ()
 Return the memory footprint in bytes of this Mask. More...
 
static uint32_t bitCount ()
 Return the number of bits available in this Mask. More...
 
static uint32_t wordCount ()
 Return the number of machine words used by this Mask. More...
 

Static Public Attributes

static constexpr uint32_t SIZE = 1U << (3 * LOG2DIM)
 
static constexpr uint32_t WORD_COUNT = SIZE >> 6
 

Detailed Description

template<uint32_t LOG2DIM>
class nanovdb::Mask< LOG2DIM >

Bit-mask to encode active states and facilitate sequential iterators and a fast codec for I/O compression.

Member Typedef Documentation

using OffIterator = Iterator<false>
using OnIterator = Iterator<true>

Constructor & Destructor Documentation

Mask ( )
inline

Initialize all bits to zero.

Mask ( bool  on)
inline
Mask ( const Mask< LOG2DIM > &  other)
inline

Copy constructor.

Member Function Documentation

DenseIterator beginAll ( ) const
inline
OffIterator beginOff ( ) const
inline
OnIterator beginOn ( ) const
inline
static uint32_t bitCount ( )
inlinestatic

Return the number of bits available in this Mask.

uint32_t countOn ( ) const
inline

Return the total number of set bits in this Mask.

uint32_t countOn ( uint32_t  i) const
inline

Return the number of lower set bits in mask up to but excluding the i'th bit.

uint32_t findFirst ( ) const
inline
uint32_t findNext ( uint32_t  start) const
inline
uint32_t findPrev ( uint32_t  start) const
inline
bool isOff ( uint32_t  n) const
inline

Return true if the given bit is NOT set.

bool isOff ( ) const
inline

Return true if none of the bits are set in this Mask.

bool isOn ( uint32_t  n) const
inline

Return true if the given bit is set.

bool isOn ( ) const
inline

Return true if all the bits are set in this Mask.

static size_t memUsage ( )
inlinestatic

Return the memory footprint in bytes of this Mask.

bool operator!= ( const Mask< LOG2DIM > &  other) const
inline
Mask& operator&= ( const Mask< LOG2DIM > &  other)
inline

Bitwise intersection.

Mask& operator-= ( const Mask< LOG2DIM > &  other)
inline

Bitwise difference.

enable_if<!is_same<MaskT, Mask>::value, Mask&>::type operator= ( const MaskT &  other)
inline

Assignment operator that works with openvdb::util::NodeMask.

Mask& operator= ( const Mask< LOG2DIM > &  other)
inline
bool operator== ( const Mask< LOG2DIM > &  other) const
inline
Mask& operator^= ( const Mask< LOG2DIM > &  other)
inline

Bitwise XOR.

Mask& operator|= ( const Mask< LOG2DIM > &  other)
inline

Bitwise union.

void set ( uint32_t  n,
bool  on 
)
inline

Set the specified bit on or off.

void set ( bool  on)
inline

Set all bits off.

void setOff ( uint32_t  n)
inline

Set the specified bit off.

void setOff ( )
inline

Set all bits off.

void setOn ( uint32_t  n)
inline

Set the specified bit on.

void setOn ( )
inline

Set all bits on.

void toggle ( )
inline

brief Toggle the state of all bits in the mask

void toggle ( uint32_t  n)
inline
static uint32_t wordCount ( )
inlinestatic

Return the number of machine words used by this Mask.

uint64_t* words ( )
inline

Return a pointer to the list of words of the bit mask.

const uint64_t* words ( ) const
inline

Member Data Documentation

constexpr uint32_t SIZE = 1U << (3 * LOG2DIM)
static
constexpr uint32_t WORD_COUNT = SIZE >> 6
static