HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim > Class Template Reference

Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation. More...

#include <NodeMasks.h>

Public Types

typedef Index64 Word
 
typedef OnMaskIterator< NodeMaskOnIterator
 
typedef OffMaskIterator< NodeMaskOffIterator
 
typedef DenseMaskIterator
< NodeMask
DenseIterator
 

Public Member Functions

 HBOOST_STATIC_ASSERT (Log2Dim >2)
 
 NodeMask ()
 Default constructor sets all bits off. More...
 
 NodeMask (bool on)
 All bits are set to the specified state. More...
 
 NodeMask (const NodeMask &other)
 Copy constructor. More...
 
 ~NodeMask ()
 Destructor. More...
 
NodeMaskoperator= (const NodeMask &other)
 Assignment operator. More...
 
OnIterator beginOn () const
 
OnIterator endOn () const
 
OffIterator beginOff () const
 
OffIterator endOff () const
 
DenseIterator beginDense () const
 
DenseIterator endDense () const
 
bool operator== (const NodeMask &other) const
 
bool operator!= (const NodeMask &other) const
 
template<typename WordOp >
const NodeMaskforeach (const NodeMask &other, const WordOp &op)
 Apply a functor to the words of the this and the other mask. More...
 
template<typename WordOp >
const NodeMaskforeach (const NodeMask &other1, const NodeMask &other2, const WordOp &op)
 
template<typename WordOp >
const NodeMaskforeach (const NodeMask &other1, const NodeMask &other2, const NodeMask &other3, const WordOp &op)
 
const NodeMaskoperator&= (const NodeMask &other)
 Bitwise intersection. More...
 
const NodeMaskoperator|= (const NodeMask &other)
 Bitwise union. More...
 
const NodeMaskoperator-= (const NodeMask &other)
 Bitwise difference. More...
 
const NodeMaskoperator^= (const NodeMask &other)
 Bitwise XOR. More...
 
NodeMask operator! () const
 
NodeMask operator& (const NodeMask &other) const
 
NodeMask operator| (const NodeMask &other) const
 
NodeMask operator^ (const NodeMask &other) const
 
Index32 countOn () const
 Return the total number of on bits. More...
 
Index32 countOff () const
 Return the total number of on bits. More...
 
void setOn (Index32 n)
 Set the nth bit on. More...
 
void setOff (Index32 n)
 Set the nth bit off. More...
 
void set (Index32 n, bool On)
 Set the nth bit to the specified state. More...
 
void set (bool on)
 Set all bits to the specified state. More...
 
void setOn ()
 Set all bits on. More...
 
void setOff ()
 Set all bits off. More...
 
void toggle (Index32 n)
 Toggle the state of the nth bit. More...
 
void toggle ()
 Toggle the state of all bits in the mask. More...
 
void setFirstOn ()
 Set the first bit on. More...
 
void setLastOn ()
 Set the last bit on. More...
 
void setFirstOff ()
 Set the first bit off. More...
 
void setLastOff ()
 Set the last bit off. More...
 
bool isOn (Index32 n) const
 Return true if the nth bit is on. More...
 
bool isOff (Index32 n) const
 Return true if the nth bit is off. More...
 
bool isOn () const
 Return true if all the bits are on. More...
 
bool isOff () const
 Return true if all the bits are off. More...
 
bool isConstant (bool &isOn) const
 
Index32 findFirstOn () const
 
Index32 findFirstOff () const
 
void save (std::ostream &os) const
 
void load (std::istream &is)
 
void seek (std::istream &is) const
 
void printInfo (std::ostream &os=std::cout) const
 simple print method for debugging More...
 
void printBits (std::ostream &os=std::cout, Index32 max_out=80u) const
 
void printAll (std::ostream &os=std::cout, Index32 max_out=80u) const
 
Index32 findNextOn (Index32 start) const
 
Index32 findNextOff (Index32 start) const
 
template<typename WordT >
WordT getWord (Index n) const
 Return the nth word of the bit mask, for a word of arbitrary size. More...
 
template<typename WordT >
WordT & getWord (Index n)
 Return the nth word of the bit mask, for a word of arbitrary size. More...
 

Static Public Member Functions

static Index32 memUsage ()
 Return the byte size of this NodeMask. More...
 

Static Public Attributes

static const Index32 LOG2DIM = Log2Dim
 
static const Index32 DIM = 1<<Log2Dim
 
static const Index32 SIZE = 1<<3*Log2Dim
 
static const Index32 WORD_COUNT = SIZE >> 6
 

Detailed Description

template<Index Log2Dim>
class openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >

Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation.

Note
A template specialization for Log2Dim=1 and Log2Dim=2 are given below.

Definition at line 302 of file NodeMasks.h.

Member Typedef Documentation

Definition at line 345 of file NodeMasks.h.

Definition at line 344 of file NodeMasks.h.

Definition at line 343 of file NodeMasks.h.

template<Index Log2Dim>
typedef Index64 openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::Word

Definition at line 311 of file NodeMasks.h.

Constructor & Destructor Documentation

template<Index Log2Dim>
openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::NodeMask ( )
inline

Default constructor sets all bits off.

Definition at line 327 of file NodeMasks.h.

template<Index Log2Dim>
openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::NodeMask ( bool  on)
inline

All bits are set to the specified state.

Definition at line 329 of file NodeMasks.h.

template<Index Log2Dim>
openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::NodeMask ( const NodeMask< Log2Dim > &  other)
inline

Copy constructor.

Definition at line 331 of file NodeMasks.h.

template<Index Log2Dim>
openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::~NodeMask ( )
inline

Destructor.

Definition at line 333 of file NodeMasks.h.

Member Function Documentation

template<Index Log2Dim>
DenseIterator openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::beginDense ( ) const
inline

Definition at line 351 of file NodeMasks.h.

template<Index Log2Dim>
OffIterator openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::beginOff ( ) const
inline

Definition at line 349 of file NodeMasks.h.

template<Index Log2Dim>
OnIterator openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::beginOn ( ) const
inline

Definition at line 347 of file NodeMasks.h.

template<Index Log2Dim>
Index32 openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::countOff ( ) const
inline

Return the total number of on bits.

Definition at line 445 of file NodeMasks.h.

template<Index Log2Dim>
Index32 openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::countOn ( ) const
inline

Return the total number of on bits.

Definition at line 438 of file NodeMasks.h.

template<Index Log2Dim>
DenseIterator openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::endDense ( ) const
inline

Definition at line 352 of file NodeMasks.h.

template<Index Log2Dim>
OffIterator openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::endOff ( ) const
inline

Definition at line 350 of file NodeMasks.h.

template<Index Log2Dim>
OnIterator openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::endOn ( ) const
inline

Definition at line 348 of file NodeMasks.h.

template<Index Log2Dim>
Index32 openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::findFirstOff ( ) const
inline

Definition at line 536 of file NodeMasks.h.

template<Index Log2Dim>
Index32 openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::findFirstOn ( ) const
inline

Definition at line 529 of file NodeMasks.h.

template<Index Log2Dim>
Index32 openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::findNextOff ( Index32  start) const
inline

Definition at line 606 of file NodeMasks.h.

template<Index Log2Dim>
Index32 openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::findNextOn ( Index32  start) const
inline

Definition at line 594 of file NodeMasks.h.

template<Index Log2Dim>
template<typename WordOp >
const NodeMask& openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::foreach ( const NodeMask< Log2Dim > &  other,
const WordOp &  op 
)
inline

Apply a functor to the words of the this and the other mask.

An example that implements the "operator&=" method:

struct Op { inline void operator()(W &w1, const W& w2) const { w1 &= w2; } };

Definition at line 374 of file NodeMasks.h.

template<Index Log2Dim>
template<typename WordOp >
const NodeMask& openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::foreach ( const NodeMask< Log2Dim > &  other1,
const NodeMask< Log2Dim > &  other2,
const WordOp &  op 
)
inline

Definition at line 382 of file NodeMasks.h.

template<Index Log2Dim>
template<typename WordOp >
const NodeMask& openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::foreach ( const NodeMask< Log2Dim > &  other1,
const NodeMask< Log2Dim > &  other2,
const NodeMask< Log2Dim > &  other3,
const WordOp &  op 
)
inline

Definition at line 390 of file NodeMasks.h.

template<Index Log2Dim>
template<typename WordT >
WordT openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::getWord ( Index  n) const
inline

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

Definition at line 547 of file NodeMasks.h.

template<Index Log2Dim>
template<typename WordT >
WordT& openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::getWord ( Index  n)
inline

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

Definition at line 553 of file NodeMasks.h.

template<Index Log2Dim>
openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::HBOOST_STATIC_ASSERT ( Log2Dim  ,
 
)
template<Index Log2Dim>
bool openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::isConstant ( bool &  isOn) const
inline

Return true if bits are either all off OR all on.

Parameters
isOnTakes on the values of all bits if the method returns true - else it is undefined.

Definition at line 521 of file NodeMasks.h.

template<Index Log2Dim>
bool openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::isOff ( Index32  n) const
inline

Return true if the nth bit is off.

Definition at line 503 of file NodeMasks.h.

template<Index Log2Dim>
bool openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::isOff ( ) const
inline

Return true if all the bits are off.

Definition at line 512 of file NodeMasks.h.

template<Index Log2Dim>
bool openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::isOn ( Index32  n) const
inline

Return true if the nth bit is on.

Definition at line 497 of file NodeMasks.h.

template<Index Log2Dim>
bool openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::isOn ( ) const
inline

Return true if all the bits are on.

Definition at line 505 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::load ( std::istream &  is)
inline

Definition at line 564 of file NodeMasks.h.

template<Index Log2Dim>
static Index32 openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::memUsage ( )
inlinestatic

Return the byte size of this NodeMask.

Definition at line 436 of file NodeMasks.h.

template<Index Log2Dim>
NodeMask openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::operator! ( void  ) const
inline

Definition at line 430 of file NodeMasks.h.

template<Index Log2Dim>
bool openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::operator!= ( const NodeMask< Log2Dim > &  other) const
inline

Definition at line 361 of file NodeMasks.h.

template<Index Log2Dim>
NodeMask openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::operator& ( const NodeMask< Log2Dim > &  other) const
inline

Definition at line 431 of file NodeMasks.h.

template<Index Log2Dim>
const NodeMask& openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::operator&= ( const NodeMask< Log2Dim > &  other)
inline

Bitwise intersection.

Definition at line 399 of file NodeMasks.h.

template<Index Log2Dim>
const NodeMask& openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::operator-= ( const NodeMask< Log2Dim > &  other)
inline

Bitwise difference.

Definition at line 415 of file NodeMasks.h.

template<Index Log2Dim>
NodeMask& openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::operator= ( const NodeMask< Log2Dim > &  other)
inline

Assignment operator.

Definition at line 335 of file NodeMasks.h.

template<Index Log2Dim>
bool openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::operator== ( const NodeMask< Log2Dim > &  other) const
inline

Definition at line 354 of file NodeMasks.h.

template<Index Log2Dim>
NodeMask openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::operator^ ( const NodeMask< Log2Dim > &  other) const
inline

Definition at line 433 of file NodeMasks.h.

template<Index Log2Dim>
const NodeMask& openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::operator^= ( const NodeMask< Log2Dim > &  other)
inline

Bitwise XOR.

Definition at line 423 of file NodeMasks.h.

template<Index Log2Dim>
NodeMask openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::operator| ( const NodeMask< Log2Dim > &  other) const
inline

Definition at line 432 of file NodeMasks.h.

template<Index Log2Dim>
const NodeMask& openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::operator|= ( const NodeMask< Log2Dim > &  other)
inline

Bitwise union.

Definition at line 407 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::printAll ( std::ostream &  os = std::cout,
Index32  max_out = 80u 
) const
inline

Definition at line 588 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::printBits ( std::ostream &  os = std::cout,
Index32  max_out = 80u 
) const
inline

Definition at line 576 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::printInfo ( std::ostream &  os = std::cout) const
inline

simple print method for debugging

Definition at line 571 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::save ( std::ostream &  os) const
inline

Definition at line 560 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::seek ( std::istream &  is) const
inline

Definition at line 567 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::set ( Index32  n,
bool  On 
)
inline

Set the nth bit to the specified state.

Definition at line 457 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::set ( bool  on)
inline

Set all bits to the specified state.

Definition at line 459 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::setFirstOff ( )
inline

Set the first bit off.

Definition at line 493 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::setFirstOn ( )
inline

Set the first bit on.

Definition at line 489 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::setLastOff ( )
inline

Set the last bit off.

Definition at line 495 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::setLastOn ( )
inline

Set the last bit on.

Definition at line 491 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::setOff ( Index32  n)
inline

Set the nth bit off.

Definition at line 452 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::setOff ( )
inline

Set all bits off.

Definition at line 472 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::setOn ( Index32  n)
inline

Set the nth bit on.

Definition at line 447 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::setOn ( )
inline

Set all bits on.

Definition at line 466 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::toggle ( Index32  n)
inline

Toggle the state of the nth bit.

Definition at line 478 of file NodeMasks.h.

template<Index Log2Dim>
void openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::toggle ( )
inline

Toggle the state of all bits in the mask.

Definition at line 483 of file NodeMasks.h.

Member Data Documentation

template<Index Log2Dim>
const Index32 openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::DIM = 1<<Log2Dim
static

Definition at line 308 of file NodeMasks.h.

template<Index Log2Dim>
const Index32 openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::LOG2DIM = Log2Dim
static

Definition at line 307 of file NodeMasks.h.

template<Index Log2Dim>
const Index32 openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::SIZE = 1<<3*Log2Dim
static

Definition at line 309 of file NodeMasks.h.

template<Index Log2Dim>
const Index32 openvdb::OPENVDB_VERSION_NAME::util::NodeMask< Log2Dim >::WORD_COUNT = SIZE >> 6
static

Definition at line 310 of file NodeMasks.h.


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