OpenVDB: Mask< LOG2DIM > Class Template Reference

OpenVDB 10.1.0

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | 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 | 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.
uint32_t | countOn (uint32_t i) const
| Return the number of lower set bits in mask up to but excluding the i'th bit.
OnIterator | beginOn () const
OffIterator | beginOff () const
| Mask ()
| Initialize all bits to zero.
| Mask (bool on)
| Mask (const Mask &other)
| Copy constructor.
template<typename WordT >
const WordT & | getWord (int n) const
| Return a const reference to the nth word of the bit mask, for a word of arbitrary size.
template<typename WordT >
WordT & | getWord (int n)
| Return a reference to the nth word of the bit mask, for a word of arbitrary size.
template<typename MaskT >
Mask & | operator= (const MaskT &other)
| Assignment operator that works with openvdb::util::NodeMask.
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.
bool | isOff (uint32_t n) const
| Return true if the given bit is NOT set.
bool | isOn () const
| Return true if all the bits are set in this Mask.
bool | isOff () const
| Return true if none of the bits are set in this Mask.
void | setOn (uint32_t n)
| Set the specified bit on.
void | setOff (uint32_t n)
| Set the specified bit off.
void | set (uint32_t n, bool On)
| Set the specified bit on or off.
void | setOn ()
| Set all bits on.
void | setOff ()
| Set all bits off.
void | set (bool on)
| Set all bits off.
void | toggle ()
| brief Toggle the state of all bits in the mask
void | toggle (uint32_t n)
Mask & | operator&= (const Mask &other)
| Bitwise intersection.
Mask & | operator|= (const Mask &other)
| Bitwise union.
Mask & | operator-= (const Mask &other)
| Bitwise difference.
Mask & | operator^= (const Mask &other)
| Bitwise XOR.

## Static Public Member Functions
static size_t | memUsage ()
| Return the memory footprint in bytes of this Mask.
static uint32_t | bitCount ()
| Return the number of bits available in this Mask.
static uint32_t | wordCount ()
| Return the number of machine words used by this Mask.

## 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

## ◆ OffIterator

template<uint32_t LOG2DIM>

using OffIterator = Iterator<false>

## ◆ OnIterator

template<uint32_t LOG2DIM>

using OnIterator = Iterator<true>

## Constructor & Destructor Documentation

## ◆ Mask() [1/3]

template<uint32_t LOG2DIM>

Mask | ( |  | ) |
| inline

Initialize all bits to zero.

## ◆ Mask() [2/3]

template<uint32_t LOG2DIM>

Mask | ( | bool | on | ) |
| inline

## ◆ Mask() [3/3]

template<uint32_t LOG2DIM>

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

Copy constructor.

## Member Function Documentation

## ◆ beginOff()

template<uint32_t LOG2DIM>

OffIterator beginOff | ( |  | ) | const
| inline

## ◆ beginOn()

template<uint32_t LOG2DIM>

OnIterator beginOn | ( |  | ) | const
| inline

## ◆ bitCount()

template<uint32_t LOG2DIM>

static uint32_t bitCount | ( |  | ) |
| inlinestatic

Return the number of bits available in this Mask.

## ◆ countOn() [1/2]

template<uint32_t LOG2DIM>

uint32_t countOn | ( |  | ) | const
| inline

Return the total number of set bits in this Mask.

## ◆ countOn() [2/2]

template<uint32_t LOG2DIM>

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.

## ◆ getWord() [1/2]

template<uint32_t LOG2DIM>
template<typename WordT >

WordT & getWord | ( | int | n | ) |
| inline

Return a reference to the nth word of the bit mask, for a word of arbitrary size.

## ◆ getWord() [2/2]

template<uint32_t LOG2DIM>
template<typename WordT >

const WordT & getWord | ( | int | n | ) | const
| inline

Return a const reference to the nth word of the bit mask, for a word of arbitrary size.

## ◆ isOff() [1/2]

template<uint32_t LOG2DIM>

bool isOff | ( |  | ) | const
| inline

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

## ◆ isOff() [2/2]

template<uint32_t LOG2DIM>

bool isOff | ( | uint32_t | n | ) | const
| inline

Return true if the given bit is NOT set.

## ◆ isOn() [1/2]

template<uint32_t LOG2DIM>

bool isOn | ( |  | ) | const
| inline

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

## ◆ isOn() [2/2]

template<uint32_t LOG2DIM>

bool isOn | ( | uint32_t | n | ) | const
| inline

Return true if the given bit is set.

## ◆ memUsage()

template<uint32_t LOG2DIM>

static size_t memUsage | ( |  | ) |
| inlinestatic

Return the memory footprint in bytes of this Mask.

## ◆ operator!=()

template<uint32_t LOG2DIM>

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

## ◆ operator&=()

template<uint32_t LOG2DIM>

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

Bitwise intersection.

## ◆ operator-=()

template<uint32_t LOG2DIM>

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

Bitwise difference.

## ◆ operator=()

template<uint32_t LOG2DIM>
template<typename MaskT >

Mask & operator= | ( | const MaskT & | other | ) |
| inline

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

## ◆ operator==()

template<uint32_t LOG2DIM>

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

## ◆ operator^=()

template<uint32_t LOG2DIM>

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

Bitwise XOR.

## ◆ operator|=()

template<uint32_t LOG2DIM>

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

Bitwise union.

## ◆ set() [1/2]

template<uint32_t LOG2DIM>

void set | ( | bool | on | ) |
| inline

Set all bits off.

## ◆ set() [2/2]

template<uint32_t LOG2DIM>

void set | ( | uint32_t | n,
|  | bool | On
| ) |  |
| inline

Set the specified bit on or off.

## ◆ setOff() [1/2]

template<uint32_t LOG2DIM>

void setOff | ( |  | ) |
| inline

Set all bits off.

## ◆ setOff() [2/2]

template<uint32_t LOG2DIM>

void setOff | ( | uint32_t | n | ) |
| inline

Set the specified bit off.

## ◆ setOn() [1/2]

template<uint32_t LOG2DIM>

void setOn | ( |  | ) |
| inline

Set all bits on.

## ◆ setOn() [2/2]

template<uint32_t LOG2DIM>

void setOn | ( | uint32_t | n | ) |
| inline

Set the specified bit on.

## ◆ toggle() [1/2]

template<uint32_t LOG2DIM>

void toggle | ( |  | ) |
| inline

brief Toggle the state of all bits in the mask

## ◆ toggle() [2/2]

template<uint32_t LOG2DIM>

void toggle | ( | uint32_t | n | ) |
| inline

## ◆ wordCount()

template<uint32_t LOG2DIM>

static uint32_t wordCount | ( |  | ) |
| inlinestatic

Return the number of machine words used by this Mask.