HDK
|
A class to manage an ordered array which has fixed offset handles. More...
#include <GA_IndexMap.h>
Classes | |
class | AttributeCompare |
class | IndexCompare |
class | Marker |
Friends | |
class | GA_Detail |
NOTE: These are friends so that they can call compactIndicesIfNeeded. More... | |
class | GU_DetailHandleRef |
class | GA_AttributeSet |
NOTE: This friend is so that GA_AttributeSet::replace can call copyFrom. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from UT_NonCopyableNS::UT_NonCopyable | |
UT_NonCopyable ()=default | |
~UT_NonCopyable ()=default | |
UT_NonCopyable (const UT_NonCopyable &)=delete | |
UT_NonCopyable & | operator= (const UT_NonCopyable &)=delete |
A class to manage an ordered array which has fixed offset handles.
The GA_Detail keeps an ordered list of elements (points, vertices etc.) maintained by this class. Each ordered element (named "index") also has a fixed offset. The offset remains constant as elements are added/removed from the detail. The offset is used for indexing into
This class (GA_IndexMap) keeps track of the vacancies and the order of elements.
During some operations, temporary elements are also created. This class maintains temporary elements too.
Definition at line 63 of file GA_IndexMap.h.
GA_IndexMap::GA_IndexMap | ( | GA_Detail & | detail, |
GA_AttributeOwner | type | ||
) |
GA_IndexMap::~GA_IndexMap | ( | ) |
|
inline |
Add a new element to the list, returning the data offset of the new element.
Definition at line 442 of file GA_IndexMap.h.
Add new elements to the list, returning the first offset of the contiguous block
|
inline |
This is used as a quick check in defragmentation, in case this index map is actually defragmented, but not trivial for some reason.
Definition at line 653 of file GA_IndexMap.h.
void GA_IndexMap::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.)
bool GA_IndexMap::cycleIndices | ( | GA_Size | offset | ) |
Shift/cycle elements in the list.
Shift/cycle elements in the list.
Delete an element from the list by specifying the order.
Delete an element from the list by the data offset.
|
inline |
Returns the first offset in [start, end) which is active If none are vacant, return end. No bounds checking is done.
Definition at line 479 of file GA_IndexMap.h.
|
inline |
Returns the first offset in [start, end) which is inactive. If none are inactive, return end. No bounds checking is done.
Definition at line 473 of file GA_IndexMap.h.
Non-compacting method to find the true order of the given data_offset. This method may need to search the non-compact mapping for holes, and so sequential calls can easily result in O(n^2) behaviour.
Given an offset, this skips the step ordered index and returns the next fixed offset. This method may do an O(N) search for the result, but is guaranteed to be const. It's primarily designed for use in GA_RTIIndex.
Given an ordered index, this returns the fixed offset associated with the index. This method may do an O(N) search for the result, but is guaranteed to be const. It's primarily designed for use in GA_RTIIndex.
|
inline |
Calls functor on every active offset in this index map.
Definition at line 495 of file GA_IndexMap.h.
|
inline |
Calls functor on every active offset in this index map, until functor returns false for some element.
Definition at line 528 of file GA_IndexMap.h.
|
inline |
Access the detail this index map belongs to.
Definition at line 70 of file GA_IndexMap.h.
int64 GA_IndexMap::getMemoryUsage | ( | bool | inclusive | ) | const |
Report the memory used (includes all shared memory)
|
inline |
The capacity for offsets. Attribute arrays must be able to store at least this much storage.
Definition at line 89 of file GA_IndexMap.h.
|
inline |
Returns a copy of our offset from index list, first ensuring it is up to date. Note this is a copy so will not remain in sync.
Definition at line 244 of file GA_IndexMap.h.
|
inline |
What type of element is stored in the index.
Definition at line 72 of file GA_IndexMap.h.
|
inline |
Given an element offset, this returns the ordered index. NOTE: Calling the indexFromOffset() function may invoke internal data modifications (i.e. these operations may be mutable). These operations are potentially expensive and should be avoided if possible.
Definition at line 145 of file GA_IndexMap.h.
|
inline |
Return number of elements in the list. This indexSize() is always <= the offsetSize()
Definition at line 103 of file GA_IndexMap.h.
|
inline |
Definition at line 307 of file GA_IndexMap.h.
|
inline |
Returns true if the specified offset is referenced by an ordered element.
Definition at line 483 of file GA_IndexMap.h.
|
inline |
Returns true if the specified offset is referenced by an ordered element No bounds checking is done.
Definition at line 465 of file GA_IndexMap.h.
|
inline |
Returns whether the offset is in the valid range of offsets for this index map.
Definition at line 456 of file GA_IndexMap.h.
bool GA_IndexMap::isOffsetTransient | ( | GA_Offset | offset | ) | const |
Returns true if the specified offset is being used for a temporary element.
bool GA_IndexMap::isOffsetVacant | ( | GA_Offset | offset | ) | const |
Returns true if the specified offset is not in use (i.e. vacant) NOTE: Inactive != Vacant. There are temporaries.
|
inline |
Returns true iff the index maps are trivial and equal, or non-trivial and share the exact same data. This does not fully check for equality!
Definition at line 615 of file GA_IndexMap.h.
|
inline |
A trivial map is one where offsetFromIndex(i) == i for all elements. That is, the offsets are in order and there are no vacancies.
Definition at line 290 of file GA_IndexMap.h.
|
inline |
Obtain offset of the element with the last index. Returns GA_INVALID_OFFSET if empty. NOTE: The offset will never be a temporary element, since temporary elements have no indices.
Definition at line 179 of file GA_IndexMap.h.
GA_Offset GA_IndexMap::nextNewElementOffset | ( | ) | const |
Returns the start offset that the next call to addElementBlock would return, (assuming it doesn't exceed the hard limit.)
|
inline |
When accessing the map functions (i.e. mapping from order to data offsets), the map may be compacted. This is a potentially expensive operation and should be avoided if possible. Given an ordered index, this returns the fixed offset associated with the index. NOTE: Calling the offsetFromIndex() function may invoke internal data modifications (i.e. these operations may be mutable). These operations are potentially expensive and should be avoided if possible.
Definition at line 117 of file GA_IndexMap.h.
|
inline |
This is an exclusive upper bound when iterating over offsets. Every active or temporary offset in this index map will be strictly less than this. It is always guaranteed that: myMaxOccupiedOffset < offsetSize() <= getOffsetCapacity()
Definition at line 97 of file GA_IndexMap.h.
Reorder an element. The index of the element at the given data offset will be changed to the new order (provided that the ordered position is in a valid range).
bool GA_IndexMap::reverseIndices | ( | ) |
Reverse a selection of elements
bool GA_IndexMap::reverseIndices | ( | const GA_Range & | range | ) |
Reverse a selection of elements
bool GA_IndexMap::sortIndices | ( | IndexCompare & | compare, |
bool | stable = true |
||
) |
Sort the index order using a comparator.
bool GA_IndexMap::sortIndices | ( | IndexCompare & | compare, |
const GA_Range & | range, | ||
bool | stable = true |
||
) |
Sort a selection of elements.
bool GA_IndexMap::sortOffsetArray | ( | GA_OffsetArray & | offsets, |
IndexCompare & | compare, | ||
bool | stable = true |
||
) | const |
Sort an array of GA_Offset data according to a comparator.
Swap the order of the two specified (ordered, not transient) data offsets.
Swap the order of the two specified (ordered, not transient) data offsets.
|
friend |
NOTE: This friend is so that GA_AttributeSet::replace can call copyFrom.
Definition at line 784 of file GA_IndexMap.h.
NOTE: These are friends so that they can call compactIndicesIfNeeded.
Definition at line 780 of file GA_IndexMap.h.
|
friend |
Definition at line 781 of file GA_IndexMap.h.