Loading...
Searching...
No Matches
VdfMask Class Reference

A VdfMask is placed on connections to specify the data flowing through them. More...

#include <mask.h>

Classes

struct  ArbitraryLessThan
 Arbitrary total ordering of masks. More...
 
struct  HashFunctor
 Hash Functor. More...
 
class  iterator
 Iterator class used to iterate through the elements of the mask. More...
 

Public Types

typedef TfCompressedBits Bits
 Typedef on the internal bitset implementation used.
 

Public Member Functions

 VdfMask ()
 Constructs an empty mask.
 
 VdfMask (size_t size)
 Constructs a mask of size size.
 
 VdfMask (VdfMask::Bits const &bits)
 Constructs a mask from VdfMask::Bits.
 
 VdfMask (VdfMask::Bits &&bits)
 Constructs a mask by moving the contents of bits into the mask.
 
void Swap (VdfMask &rhs) noexcept
 Swap this mask's bits with rhs.
 
void SetAll ()
 Enables all the bits in the mask.
 
void SetIndex (size_t index)
 Adds the given index to the mask.
 
bool IsSet (size_t index) const
 Returns true if mask at index is set.
 
void ClearIndex (size_t index)
 Removes the given index from the mask.
 
size_t GetSize () const
 Returns the size of the mask.
 
bool IsEmpty () const
 Returns true if this mask is empty, i.e.
 
bool Overlaps (const VdfMask &mask) const
 Returns true if this mask and mask have any set entries in common, and false otherwise.
 
bool Contains (const VdfMask &mask) const
 Returns true if mask is a subset-of or equal to this mask, false otherwise.
 
bool IsAllOnes () const
 Returns true if this mask has all entries set.
 
bool IsAllZeros () const
 Returns true if this mask has all entries unset.
 
bool IsAnySet () const
 Returns true, if there is at least a single set entry.
 
size_t GetFirstSet () const
 Returns the first set bit in the mask.
 
size_t GetLastSet () const
 Returns the last set bit in the mask.
 
size_t GetNumSet () const
 Returns the number of set bits in the mask.
 
bool IsContiguous () const
 Returns true if the set bits in the mask are contiguous.
 
iterator begin () const
 Returns an iterator that can be used to iterate through the elements of the mask.
 
Operators
bool operator== (const VdfMask &rhs) const
 Returns true if this and rhs are equal, false otherwise.
 
bool operator!= (const VdfMask &rhs) const
 
VdfMaskoperator&= (const VdfMask &rhs)
 Ands two masks together.
 
VdfMask operator& (const VdfMask &rhs) const
 
VdfMaskoperator|= (const VdfMask &rhs)
 Ors two masks together.
 
VdfMask operator| (const VdfMask &rhs) const
 
VdfMaskoperator^= (const VdfMask &rhs)
 Xors two masks together.
 
VdfMask operator^ (const VdfMask &rhs) const
 
VdfMaskoperator-= (const VdfMask &rhs)
 Performs an asymmetric set difference.
 
VdfMask operator- (const VdfMask &rhs) const
 
VdfMaskComplement ()
 Complement.
 
VdfMaskSetOrAppend (const VdfMask &rhs)
 Sets this mask to rhs if this mask is of zero size.
 
Debugging API
std::string GetRLEString () const
 Returns the mask in an RLE format.
 
size_t GetMemoryUsage () const
 Returns the amount of memory in bytes used by this mask.
 
Performance Considerations
VdfMask::Bits const & GetBits () const
 Get this mask's content as CtCompressedfBits.
 
size_t GetHash () const
 Returns a hash for the mask.
 

Static Public Member Functions

static VdfMask AllOnes (size_t size)
 Returns a mask of the requested size that will iterate over all elements.
 
static VdfMask AllZeros (size_t size)
 Returns a mask of the requested size where no element is set.
 

Friends

class Vdf_MaskRegistry
 
void swap (VdfMask &lhs, VdfMask &rhs) noexcept
 Swap lhs's bits with rhs.
 
VDF_API std::ostream & operator<< (std::ostream &os, const VdfMask &mask)
 
void TfDelegatedCountIncrement (_BitsImpl *p) noexcept
 
void TfDelegatedCountDecrement (_BitsImpl *p) noexcept
 

Detailed Description

A VdfMask is placed on connections to specify the data flowing through them.

Definition at line 36 of file mask.h.

Member Typedef Documentation

◆ Bits

Typedef on the internal bitset implementation used.

Definition at line 43 of file mask.h.

Constructor & Destructor Documentation

◆ VdfMask() [1/4]

VdfMask ( )
inline

Constructs an empty mask.

Definition at line 47 of file mask.h.

◆ VdfMask() [2/4]

VdfMask ( size_t  size)
inlineexplicit

Constructs a mask of size size.

Definition at line 51 of file mask.h.

◆ VdfMask() [3/4]

VdfMask ( VdfMask::Bits const &  bits)
inlineexplicit

Constructs a mask from VdfMask::Bits.

Definition at line 63 of file mask.h.

◆ VdfMask() [4/4]

VdfMask ( VdfMask::Bits &&  bits)
inlineexplicit

Constructs a mask by moving the contents of bits into the mask.

*bits may not be used after passing it to this constructor.

Definition at line 85 of file mask.h.

Member Function Documentation

◆ AllOnes()

static VdfMask AllOnes ( size_t  size)
inlinestatic

Returns a mask of the requested size that will iterate over all elements.

Definition at line 494 of file mask.h.

◆ AllZeros()

static VdfMask AllZeros ( size_t  size)
inlinestatic

Returns a mask of the requested size where no element is set.

Definition at line 509 of file mask.h.

◆ begin()

iterator begin ( ) const
inline

Returns an iterator that can be used to iterate through the elements of the mask.

Definition at line 482 of file mask.h.

◆ ClearIndex()

void ClearIndex ( size_t  index)
inline

Removes the given index from the mask.

The corresponding element will be cleared after this call.

Definition at line 143 of file mask.h.

◆ Complement()

VdfMask & Complement ( )
inline

Complement.

Flips all the bits in the mask.

Definition at line 372 of file mask.h.

◆ Contains()

bool Contains ( const VdfMask mask) const
inline

Returns true if mask is a subset-of or equal to this mask, false otherwise.

Definition at line 186 of file mask.h.

◆ GetBits()

VdfMask::Bits const & GetBits ( ) const
inline

Get this mask's content as CtCompressedfBits.

This should not be used except where performance is critical.

Definition at line 556 of file mask.h.

◆ GetFirstSet()

size_t GetFirstSet ( ) const
inline

Returns the first set bit in the mask.

Definition at line 226 of file mask.h.

◆ GetHash()

size_t GetHash ( ) const
inline

Returns a hash for the mask.

Definition at line 565 of file mask.h.

◆ GetLastSet()

size_t GetLastSet ( ) const
inline

Returns the last set bit in the mask.

Definition at line 236 of file mask.h.

◆ GetMemoryUsage()

size_t GetMemoryUsage ( ) const
inline

Returns the amount of memory in bytes used by this mask.

Note that masks are now shared, so this method is of dubious value.

Definition at line 539 of file mask.h.

◆ GetNumSet()

size_t GetNumSet ( ) const
inline

Returns the number of set bits in the mask.

Definition at line 246 of file mask.h.

◆ GetRLEString()

std::string GetRLEString ( ) const
inline

Returns the mask in an RLE format.

This is useful for debugging large masks. For example, the output of a mask that is 110001111 would be: 1x2-0x3-1x4

Definition at line 528 of file mask.h.

◆ GetSize()

size_t GetSize ( ) const
inline

Returns the size of the mask.

This is the number of elements that can be indexed in the mask, not the number of elements set.

Definition at line 158 of file mask.h.

◆ IsAllOnes()

bool IsAllOnes ( ) const
inline

Returns true if this mask has all entries set.

Definition at line 196 of file mask.h.

◆ IsAllZeros()

bool IsAllZeros ( ) const
inline

Returns true if this mask has all entries unset.

Definition at line 206 of file mask.h.

◆ IsAnySet()

bool IsAnySet ( ) const
inline

Returns true, if there is at least a single set entry.

Definition at line 216 of file mask.h.

◆ IsContiguous()

bool IsContiguous ( ) const
inline

Returns true if the set bits in the mask are contiguous.

Note: This returns false if there are no set bits in the mask.

Definition at line 258 of file mask.h.

◆ IsEmpty()

bool IsEmpty ( ) const
inline

Returns true if this mask is empty, i.e.

it is of size zero.

Definition at line 168 of file mask.h.

◆ IsSet()

bool IsSet ( size_t  index) const
inline

Returns true if mask at index is set.

Definition at line 131 of file mask.h.

◆ operator!=()

bool operator!= ( const VdfMask rhs) const
inline

Definition at line 275 of file mask.h.

◆ operator&()

VdfMask operator& ( const VdfMask rhs) const
inline

Definition at line 303 of file mask.h.

◆ operator&=()

VdfMask & operator&= ( const VdfMask rhs)
inline

Ands two masks together.

The result is that an element is set iff it is set in both masks.

Definition at line 294 of file mask.h.

◆ operator-()

VdfMask operator- ( const VdfMask rhs) const
inline

Definition at line 364 of file mask.h.

◆ operator-=()

VdfMask & operator-= ( const VdfMask rhs)
inline

Performs an asymmetric set difference.

This method turns off the bits that are set in both this and in rhs.

Definition at line 353 of file mask.h.

◆ operator==()

bool operator== ( const VdfMask rhs) const
inline

Returns true if this and rhs are equal, false otherwise.

Definition at line 271 of file mask.h.

◆ operator^()

VdfMask operator^ ( const VdfMask rhs) const
inline

Definition at line 342 of file mask.h.

◆ operator^=()

VdfMask & operator^= ( const VdfMask rhs)
inline

Xors two masks together.

The result is that an element is set iff it is set in exactly one of the two masks.

Definition at line 333 of file mask.h.

◆ operator|()

VdfMask operator| ( const VdfMask rhs) const
inline

Definition at line 322 of file mask.h.

◆ operator|=()

VdfMask & operator|= ( const VdfMask rhs)
inline

Ors two masks together.

The result is that an element is set iff it is set in either mask.

Definition at line 313 of file mask.h.

◆ Overlaps()

bool Overlaps ( const VdfMask mask) const
inline

Returns true if this mask and mask have any set entries in common, and false otherwise.

Definition at line 175 of file mask.h.

◆ SetAll()

void SetAll ( )
inline

Enables all the bits in the mask.

Definition at line 105 of file mask.h.

◆ SetIndex()

void SetIndex ( size_t  index)
inline

Adds the given index to the mask.

The corresponding element will be set after this call.

Definition at line 119 of file mask.h.

◆ SetOrAppend()

VdfMask & SetOrAppend ( const VdfMask rhs)
inline

Sets this mask to rhs if this mask is of zero size.

Otherwise, will or rhs to this mask.

Definition at line 385 of file mask.h.

◆ Swap()

void Swap ( VdfMask rhs)
inlinenoexcept

Swap this mask's bits with rhs.

Definition at line 93 of file mask.h.

Friends And Related Function Documentation

◆ swap

void swap ( VdfMask lhs,
VdfMask rhs 
)
friend

Swap lhs's bits with rhs.

Definition at line 99 of file mask.h.

◆ TfDelegatedCountDecrement

void TfDelegatedCountDecrement ( VdfMask::_BitsImpl *  p)
friend

Definition at line 703 of file mask.h.

◆ TfDelegatedCountIncrement

void TfDelegatedCountIncrement ( VdfMask::_BitsImpl *  p)
friend

Definition at line 686 of file mask.h.

◆ Vdf_MaskRegistry

friend class Vdf_MaskRegistry
friend

Definition at line 651 of file mask.h.


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