API Documentation
Public Member Functions | List of all members
nkGraphics::InfiniteMask< T > Class Template Reference

A more generic version of the InfiniteBitMask. More...

Public Member Functions

 InfiniteMask ()=default
 
 InfiniteMask (const InfiniteMask< T > &other)
 
 InfiniteMask (InfiniteMask< T > &&other)
 
 ~InfiniteMask ()=default
 
void resize (unsigned int size)
 
void setVal (unsigned int index, T value)
 
void clear ()
 
getVal (unsigned int index) const
 
unsigned int getOrder () const
 
bool checkSubPartEquality (const InfiniteMask< T > &other, unsigned int begin, unsigned int end) const
 
bool checkSubPartFill (const InfiniteMask< T > &other, unsigned int begin, unsigned int end) const
 
void mergeWith (const InfiniteMask< T > &other, bool overrideValues=false)
 
std::vector< T >::reference operator[] (size_t index)
 
operator[] (size_t index) const
 
bool operator== (const InfiniteMask< T > &other) const
 
bool operator!= (const InfiniteMask< T > &other) const
 
bool operator< (const InfiniteMask< T > &other) const
 
InfiniteMaskoperator= (const InfiniteMask< T > &other)
 
InfiniteMaskoperator= (InfiniteMask< T > &&other)
 

Detailed Description

template<typename T>
class nkGraphics::InfiniteMask< T >

A more generic version of the InfiniteBitMask.

Allows to create an infinite mask with entries symbolized by any type.

Constructor & Destructor Documentation

◆ InfiniteMask() [1/3]

template<typename T >
nkGraphics::InfiniteMask< T >::InfiniteMask ( )
default

Default constructor.

◆ InfiniteMask() [2/3]

template<typename T >
nkGraphics::InfiniteMask< T >::InfiniteMask ( const InfiniteMask< T > &  other)

Copy constructor.

◆ InfiniteMask() [3/3]

template<typename T >
nkGraphics::InfiniteMask< T >::InfiniteMask ( InfiniteMask< T > &&  other)

Move constructor.

◆ ~InfiniteMask()

template<typename T >
nkGraphics::InfiniteMask< T >::~InfiniteMask ( )
default

Destructor.

Member Function Documentation

◆ resize()

template<typename T >
void nkGraphics::InfiniteMask< T >::resize ( unsigned int  size)

Resizes the mask, either filling with default values or scrapping existing ones.

Parameters
sizeThe size to resize to.

◆ setVal()

template<typename T >
void nkGraphics::InfiniteMask< T >::setVal ( unsigned int  index,
value 
)

Sets a value at given index.

Parameters
indexThe index to manipulate.
valueThe value to assign to it.

◆ clear()

template<typename T >
void nkGraphics::InfiniteMask< T >::clear ( )

Resets the mask and start fresh.

◆ getVal()

template<typename T >
T nkGraphics::InfiniteMask< T >::getVal ( unsigned int  index) const
Parameters
indexThe index of the value to retrieve.
Returns
The value assigned.

◆ getOrder()

template<typename T >
unsigned int nkGraphics::InfiniteMask< T >::getOrder ( ) const
Returns
The order of the mask, aka the highest index of a set value.

◆ checkSubPartEquality()

template<typename T >
bool nkGraphics::InfiniteMask< T >::checkSubPartEquality ( const InfiniteMask< T > &  other,
unsigned int  begin,
unsigned int  end 
) const

Compares two sub parts of masks.

Parameters
otherThe mask to compare with.
beginThe first index to start comparing from.
endThe last index of the comparison sub part.
Returns
If the sub parts are both equal.

◆ checkSubPartFill()

template<typename T >
bool nkGraphics::InfiniteMask< T >::checkSubPartFill ( const InfiniteMask< T > &  other,
unsigned int  begin,
unsigned int  end 
) const

Checks equality only for values that are set in another mask. Does not check for strict equality. If more values are set within calling mask, filling is still correct.

Parameters
otherThe mask whose values should be checked against the calling one.
beginThe first index to start comparing from.
endThe last index of the comparison sub part.
Returns
If all set values of the other mask are corresponding in the calling mask.

◆ mergeWith()

template<typename T >
void nkGraphics::InfiniteMask< T >::mergeWith ( const InfiniteMask< T > &  other,
bool  overrideValues = false 
)

Merges the mask with another one.

Parameters
otherThe mask to merge with.
overrideValuesWhether the values should be overridden or not. Override happens if the source mask has negative values, and the other positive ones.

◆ operator[]() [1/2]

template<typename T >
std::vector<T>::reference nkGraphics::InfiniteMask< T >::operator[] ( size_t  index)

Access operator.

Parameters
indexThe index to access.
Returns
A reference over the value wanted.

◆ operator[]() [2/2]

template<typename T >
T nkGraphics::InfiniteMask< T >::operator[] ( size_t  index) const

Const access operator.

Parameters
indexThe index of the bit to access.
Returns
The value requested.

◆ operator==()

template<typename T >
bool nkGraphics::InfiniteMask< T >::operator== ( const InfiniteMask< T > &  other) const

Comparison operator.

Parameters
otherThe mask to compare with.
Returns
If both masks are equal (true) or not (false).

◆ operator!=()

template<typename T >
bool nkGraphics::InfiniteMask< T >::operator!= ( const InfiniteMask< T > &  other) const

Comparison operator.

Parameters
otherThe mask to compare with.
Returns
If both mask are difference (true) or not (false).

◆ operator<()

template<typename T >
bool nkGraphics::InfiniteMask< T >::operator< ( const InfiniteMask< T > &  other) const

Comparison operator.

Parameters
otherThe mask to compare with.
Returns
If calling mask is smaller (true) or not (false).

◆ operator=() [1/2]

template<typename T >
InfiniteMask& nkGraphics::InfiniteMask< T >::operator= ( const InfiniteMask< T > &  other)

Assignment operator.

Parameters
otherThe mask to assign.
Returns
The calling mask, updated.

◆ operator=() [2/2]

template<typename T >
InfiniteMask& nkGraphics::InfiniteMask< T >::operator= ( InfiniteMask< T > &&  other)

Assignment operator.

Parameters
otherThe mask to assign.
Returns
The calling mask, updated.

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