SculptFlagChecker Class Reference

#include <lib_sculptbrush.h>

Detailed Description

A specialized class for sculpting that is optimized to store Boolean states.
Each Boolean state is represented by a single bit which reduces the memory requirements.

Public Member Functions

Bool Init (UInt32 count)
 
void Clear ()
 
UInt32 GetCount ()
 
void Set (UInt32 index)
 
Bool CheckSet (UInt32 index)
 
Bool Check (UInt32 index)
 
void UnSet (UInt32 index)
 

Static Public Member Functions

static SculptFlagCheckerAlloc ()
 
static void Free (SculptFlagChecker *&fc)
 

Private Member Functions

 SculptFlagChecker ()
 
 ~SculptFlagChecker ()
 

Constructor & Destructor Documentation

◆ SculptFlagChecker()

SculptFlagChecker ( )
private

◆ ~SculptFlagChecker()

~SculptFlagChecker ( )
private

Member Function Documentation

◆ Alloc()

static SculptFlagChecker* Alloc ( )
static

Allocates a SculptFlagChecker object. Destroy the allocated SculptFlagChecker object with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated SculptFlagChecker object, or nullptr if the allocation failed.

◆ Free()

static void Free ( SculptFlagChecker *&  fc)
static

Destructs SculptFlagChecker objects allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]fcThe SculptFlagChecker object to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ Init()

Bool Init ( UInt32  count)

Initializes with the number of states to check. Data will be allocated so that each boolean state will only use a single bit for each state.

Parameters
[in]countThe number of states that need to be set.
Returns
true if the memory could be allocated to store the required number of bits, otherwise false.

◆ Clear()

void Clear ( )

Clears the currently set states. This method is optimized for speed to only clear the memory for the bits that were actually set.

◆ GetCount()

UInt32 GetCount ( )

Gets the number of states set in the Init() method.

Returns
The value set from the Init() method.

◆ Set()

void Set ( UInt32  index)

Sets the state of the bit to true at the given index.

Parameters
[in]indexThe index of the bit to set: <= index < GetCount()

◆ CheckSet()

Bool CheckSet ( UInt32  index)

Checks the state of the bit at the given index and also sets it to true if it was not previously set.

Parameters
[in]indexThe index of the bit to check: <= index < GetCount()
Returns
true if the bit is true at the given index, otherwise false.

◆ Check()

Bool Check ( UInt32  index)

Checks the state of the bit at the given index.

Parameters
[in]indexThe index of the bit to check: <= index < GetCount()
Returns
true if the bit is true at the given index, otherwise false.

◆ UnSet()

void UnSet ( UInt32  index)

Clears the state of the bit at the given index.

Parameters
[in]indexThe index of the bit to unset: <= index < GetCount()