HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VdfMask Class Reference

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

#include <mask.h>

Classes

struct  ArbitraryLessThan
 
struct  HashFunctor
 
class  iterator
 

Public Types

typedef TfCompressedBits Bits
 

Public Member Functions

 VdfMask ()
 
 VdfMask (size_t size)
 
 VdfMask (VdfMask::Bits const &bits)
 
 VdfMask (VdfMask::Bits &&bits)
 
void Swap (VdfMask &rhs) noexcept
 
void SetAll ()
 
void SetIndex (size_t index)
 
bool IsSet (size_t index) const
 
void ClearIndex (size_t index)
 
size_t GetSize () const
 
bool IsEmpty () const
 
bool Overlaps (const VdfMask &mask) const
 
bool Contains (const VdfMask &mask) const
 
bool IsAllOnes () const
 
bool IsAllZeros () const
 
bool IsAnySet () const
 
size_t GetFirstSet () const
 
size_t GetLastSet () const
 
size_t GetNumSet () const
 
bool IsContiguous () const
 
iterator begin () const
 
Operators
bool operator== (const VdfMask &rhs) const
 
bool operator!= (const VdfMask &rhs) const
 
VdfMaskoperator&= (const VdfMask &rhs)
 
VdfMask operator& (const VdfMask &rhs) const
 
VdfMaskoperator|= (const VdfMask &rhs)
 
VdfMask operator| (const VdfMask &rhs) const
 
VdfMaskoperator^= (const VdfMask &rhs)
 
VdfMask operator^ (const VdfMask &rhs) const
 
VdfMaskoperator-= (const VdfMask &rhs)
 
VdfMask operator- (const VdfMask &rhs) const
 
VdfMaskComplement ()
 
VdfMaskSetOrAppend (const VdfMask &rhs)
 
Debugging API
std::string GetRLEString () const
 
size_t GetMemoryUsage () const
 
Performance Considerations
VdfMask::Bits const & GetBits () const
 
size_t GetHash () const
 Returns a hash for the mask. More...
 

Static Public Member Functions

static VdfMask AllOnes (size_t size)
 
static VdfMask AllZeros (size_t size)
 

Friends

class Vdf_MaskRegistry
 
void swap (VdfMask &lhs, VdfMask &rhs) noexcept
 
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

Typedef on the internal bitset implementation used.

Definition at line 38 of file mask.h.

Constructor & Destructor Documentation

VdfMask::VdfMask ( )
inline

Constructs an empty mask.

Definition at line 47 of file mask.h.

VdfMask::VdfMask ( size_t  size)
inlineexplicit

Constructs a mask of size size.

Definition at line 51 of file mask.h.

VdfMask::VdfMask ( VdfMask::Bits const &  bits)
inlineexplicit

Constructs a mask from VdfMask::Bits.

Definition at line 63 of file mask.h.

VdfMask::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

static VdfMask 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.

static VdfMask 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.

iterator VdfMask::begin ( void  ) 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.

void VdfMask::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.

VdfMask& VdfMask::Complement ( )
inline

Complement. Flips all the bits in the mask.

Definition at line 372 of file mask.h.

bool VdfMask::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.

VdfMask::Bits const& VdfMask::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.

size_t VdfMask::GetFirstSet ( ) const
inline

Returns the first set bit in the mask.

Definition at line 226 of file mask.h.

size_t VdfMask::GetHash ( ) const
inline

Returns a hash for the mask.

Definition at line 565 of file mask.h.

size_t VdfMask::GetLastSet ( ) const
inline

Returns the last set bit in the mask.

Definition at line 236 of file mask.h.

size_t VdfMask::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.

size_t VdfMask::GetNumSet ( ) const
inline

Returns the number of set bits in the mask.

Definition at line 246 of file mask.h.

std::string VdfMask::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.

size_t VdfMask::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.

bool VdfMask::IsAllOnes ( ) const
inline

Returns true if this mask has all entries set.

Definition at line 196 of file mask.h.

bool VdfMask::IsAllZeros ( ) const
inline

Returns true if this mask has all entries unset.

Definition at line 206 of file mask.h.

bool VdfMask::IsAnySet ( ) const
inline

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

Definition at line 216 of file mask.h.

bool VdfMask::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.

bool VdfMask::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.

bool VdfMask::IsSet ( size_t  index) const
inline

Returns true if mask at index is set

Definition at line 131 of file mask.h.

bool VdfMask::operator!= ( const VdfMask rhs) const
inline

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

Definition at line 275 of file mask.h.

VdfMask VdfMask::operator& ( const VdfMask rhs) const
inline

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

Definition at line 303 of file mask.h.

VdfMask& 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.

VdfMask VdfMask::operator- ( const VdfMask rhs) const
inline

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

Definition at line 364 of file mask.h.

VdfMask& 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.

bool VdfMask::operator== ( const VdfMask rhs) const
inline

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

Definition at line 271 of file mask.h.

VdfMask VdfMask::operator^ ( const VdfMask rhs) const
inline

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

Definition at line 342 of file mask.h.

VdfMask& 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.

VdfMask VdfMask::operator| ( const VdfMask rhs) const
inline

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

Definition at line 322 of file mask.h.

VdfMask& 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.

bool VdfMask::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.

void VdfMask::SetAll ( )
inline

Enables all the bits in the mask.

Definition at line 105 of file mask.h.

void VdfMask::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.

VdfMask& 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.

void VdfMask::Swap ( VdfMask rhs)
inlinenoexcept

Swap this mask's bits with rhs.

Definition at line 93 of file mask.h.

Friends And Related Function Documentation

VDF_API std::ostream& operator<< ( std::ostream &  os,
const VdfMask mask 
)
friend
void swap ( VdfMask lhs,
VdfMask rhs 
)
friend

Swap lhs's bits with rhs.

Definition at line 99 of file mask.h.

void TfDelegatedCountDecrement ( VdfMask::_BitsImpl *  p)
friend

Definition at line 703 of file mask.h.

void TfDelegatedCountIncrement ( VdfMask::_BitsImpl *  p)
friend

Definition at line 686 of file mask.h.

friend class Vdf_MaskRegistry
friend

Definition at line 651 of file mask.h.


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