HDK
|
An array of bits. More...
#include <GA_DataBitArray.h>
Public Member Functions | |
GA_DataBitArray (GA_Offset size, bool value) | |
~GA_DataBitArray () | |
void | setArraySize (GA_Offset size) |
Change the size of the array. More... | |
GA_Offset | getArraySize () const |
Query the size of the array. More... | |
void | clear () |
Clear all entries to the default value. More... | |
void | clearOffset (GA_Offset off, GA_Offset num) |
Clear a specific offset to the default. More... | |
void | makeConstant (bool value) |
Set all entries to the given value. More... | |
void | tryCompressAllPages (GA_Offset start_offset=GA_Offset(0), GA_Offset end_offset=GA_INVALID_OFFSET) |
Try to compress all pages overlapping the specified offset range. More... | |
void | hardenAllPages (GA_Offset start_offset=GA_Offset(0), GA_Offset end_offset=GA_INVALID_OFFSET) |
Harden all pages overlapping the specified offset range. More... | |
int64 | getMemoryUsage (bool inclusive) const |
Report memory usage. More... | |
void | countMemory (UT_MemoryCounter &counter, bool inclusive) const |
bool | copyFrom (const GA_DataBitArray &src) |
void | mergeGrowArrayAndCopy (const GA_MergeMap &map, GA_AttributeOwner owner, const GA_DataBitArray &src) |
GA_Size | countSetBits (GA_Offset start, GA_Offset end) const |
void | getConstantSpan (GA_Offset start, GA_Offset end, GA_Size &size, bool &value) const |
SYS_FORCE_INLINE bool | get (GA_Offset idx) const |
Access data from the array. More... | |
bool | isAnySet (const GA_Range &range) const |
Test if any bit in the range is set. More... | |
void | set (GA_Offset di, bool val) |
Set the value at a particular index. More... | |
template<bool VALUE> | |
void | set (GA_Offset di) |
Set the value at a particular index. More... | |
void | set (GA_Offset di, const GA_DataBitArray &src, GA_Offset si) |
void | set (const GA_Range &it, bool val) |
void | set (GA_Offset span_start, GA_Offset span_end, bool val) |
void | set (const GA_Range &it, const GA_DataBitArray &src) |
void | set (const GA_Range &it, const GA_DataBitArray &src, const GA_Range &sit) |
void | set (const GA_DataBitArray &src, const GA_Range &sit, const GA_MergeOffsetMap &map) |
bool | toggle (GA_Offset idx) |
Toggle the value at a particular index. More... | |
void | toggle (const GA_Range &it) |
void | andEqual (const GA_DataBitArray &src) |
Page accelerated full group operations. More... | |
void | xorEqual (const GA_DataBitArray &src) |
void | orEqual (const GA_DataBitArray &src) |
void | subEqual (const GA_DataBitArray &src) |
void | toggleAll (GA_Size numelements) |
bool | loadGroupBitArrayH9 (UT_IStream &is) |
A special method for loading group data from geo files. More... | |
bool | saveGroupBitArrayH9 (std::ostream &os, int binary, const GA_Range &it) const |
bool | jsonSave (UT_JSONWriter &w, const GA_Range &it, const UT_Options *options) const |
bool | jsonLoad (UT_JSONParser &p, const GA_LoadMap &map, GA_AttributeOwner owner) |
Load from a JSON stream. More... | |
bool | jsonLoad (UT_JSONParser &p, const UT_JSONValue &v, const GA_LoadMap &map, GA_AttributeOwner owner) |
Load from a JSON value. More... | |
SYS_FORCE_INLINE bool | isPageConstant (GA_PageNum pageid) const |
SYS_FORCE_INLINE bool | getPageCVal (GA_PageNum pageid) const |
void | tryCompressPage (GA_PageNum pageid) |
void | makePageConstant (GA_PageNum pageid, bool value) |
void | defragment (const GA_Defragment &defrag) |
Static Public Attributes | |
static constexpr uintptr_t | BIT_PAGE_PTR_MASK = ~((uintptr_t)1) |
An array of bits.
GA_DataBitArray provides an efficient way of storing bit arrays.
There are basic operations on the array.
See also: JSON Schema: GA_DataBitArray
Definition at line 48 of file GA_DataBitArray.h.
GA_DataBitArray::GA_DataBitArray | ( | GA_Offset | size, |
bool | value | ||
) |
GA_DataBitArray::~GA_DataBitArray | ( | ) |
void GA_DataBitArray::andEqual | ( | const GA_DataBitArray & | src | ) |
Page accelerated full group operations.
void GA_DataBitArray::clear | ( | ) |
Clear all entries to the default value.
Clear a specific offset to the default.
bool GA_DataBitArray::copyFrom | ( | const GA_DataBitArray & | src | ) |
Copy bit array from the source. This will change the size of the array if the source size is different.
void GA_DataBitArray::countMemory | ( | UT_MemoryCounter & | counter, |
bool | inclusive | ||
) | const |
Count memory usage using a UT_MemoryCounter in order to count shared memory correctly. If inclusive is true, the size of this object is counted, else only memory owned by this object is counted. If this is pointed to by the calling object, inclusive should be true. If this is contained in the calling object, inclusive should be false. (Its memory was already counted in the size of the calling object.)
void GA_DataBitArray::defragment | ( | const GA_Defragment & | defrag | ) |
Interface for defragmentation
|
inline |
Access data from the array.
Definition at line 109 of file GA_DataBitArray.h.
|
inline |
Query the size of the array.
Definition at line 58 of file GA_DataBitArray.h.
void GA_DataBitArray::getConstantSpan | ( | GA_Offset | start, |
GA_Offset | end, | ||
GA_Size & | size, | ||
bool & | value | ||
) | const |
Query the length of repeated bit values starting from 'start' until 'end' or a change in bit values.
int64 GA_DataBitArray::getMemoryUsage | ( | bool | inclusive | ) | const |
Report memory usage.
|
inline |
Definition at line 272 of file GA_DataBitArray.h.
void GA_DataBitArray::hardenAllPages | ( | GA_Offset | start_offset = GA_Offset(0) , |
GA_Offset | end_offset = GA_INVALID_OFFSET |
||
) |
Harden all pages overlapping the specified offset range.
bool GA_DataBitArray::isAnySet | ( | const GA_Range & | range | ) | const |
Test if any bit in the range is set.
|
inline |
Definition at line 269 of file GA_DataBitArray.h.
bool GA_DataBitArray::jsonLoad | ( | UT_JSONParser & | p, |
const GA_LoadMap & | map, | ||
GA_AttributeOwner | owner | ||
) |
Load from a JSON stream.
bool GA_DataBitArray::jsonLoad | ( | UT_JSONParser & | p, |
const UT_JSONValue & | v, | ||
const GA_LoadMap & | map, | ||
GA_AttributeOwner | owner | ||
) |
Load from a JSON value.
bool GA_DataBitArray::jsonSave | ( | UT_JSONWriter & | w, |
const GA_Range & | it, | ||
const UT_Options * | options | ||
) | const |
jsonSave() will save the array to a JSON stream. There are multiple ways to store a bit-array.
bool GA_DataBitArray::loadGroupBitArrayH9 | ( | UT_IStream & | is | ) |
A special method for loading group data from geo files.
void GA_DataBitArray::makeConstant | ( | bool | value | ) |
Set all entries to the given value.
void GA_DataBitArray::makePageConstant | ( | GA_PageNum | pageid, |
bool | value | ||
) |
void GA_DataBitArray::mergeGrowArrayAndCopy | ( | const GA_MergeMap & | map, |
GA_AttributeOwner | owner, | ||
const GA_DataBitArray & | src | ||
) |
mergeGrowArrayAndCopy() is called to grow the data array while appending or copying data from the source (non-interleaved merge). The array is resized to the new destination capacity (as defined by the map) and the data from the source array is copied over into the newly allocated area.
void GA_DataBitArray::orEqual | ( | const GA_DataBitArray & | src | ) |
bool GA_DataBitArray::saveGroupBitArrayH9 | ( | std::ostream & | os, |
int | binary, | ||
const GA_Range & | it | ||
) | const |
Set the value at a particular index.
Definition at line 128 of file GA_DataBitArray.h.
Set the value at a particular index.
Definition at line 164 of file GA_DataBitArray.h.
|
inline |
Definition at line 198 of file GA_DataBitArray.h.
void GA_DataBitArray::set | ( | const GA_Range & | it, |
const GA_DataBitArray & | src | ||
) |
void GA_DataBitArray::set | ( | const GA_Range & | it, |
const GA_DataBitArray & | src, | ||
const GA_Range & | sit | ||
) |
void GA_DataBitArray::set | ( | const GA_DataBitArray & | src, |
const GA_Range & | sit, | ||
const GA_MergeOffsetMap & | map | ||
) |
void GA_DataBitArray::subEqual | ( | const GA_DataBitArray & | src | ) |
bool GA_DataBitArray::toggle | ( | GA_Offset | idx | ) |
Toggle the value at a particular index.
void GA_DataBitArray::tryCompressAllPages | ( | GA_Offset | start_offset = GA_Offset(0) , |
GA_Offset | end_offset = GA_INVALID_OFFSET |
||
) |
Try to compress all pages overlapping the specified offset range.
void GA_DataBitArray::tryCompressPage | ( | GA_PageNum | pageid | ) |
void GA_DataBitArray::xorEqual | ( | const GA_DataBitArray & | src | ) |
|
static |
We want a bit pattern the size of a pointer whose every bit but the last is set.
Definition at line 267 of file GA_DataBitArray.h.