11 #ifndef __GA_Defragment__
12 #define __GA_Defragment__
58 DEFRAG_DEFAULT = DEFRAG_TO_ORDER
85 STRATEGY strategy=DEFRAG_DEFAULT,
90 {
return getSwapCount() == 0; }
95 {
return mapOffset(old_offset) != old_offset; }
100 {
return myOffsetMap(old_offset); }
137 return myA == i.myA && myB == i.myB && myN == i.myN && myOp == i.myOp;
147 if (myOp != cmp.myOp)
149 return myOp == MOVE_A_TO_B;
151 return myB < cmp.myB;
157 return *
this < cmp ? -1 : 1;
220 if (atEnd() && src.
atEnd())
222 return myFrag == src.myFrag && myCurr == src.myCurr;
226 return (!myFrag) || (myCurr >= myFrag->getSwapCount());
247 if (myCurr < myFrag->getSwapCount())
250 &
s = myFrag->getSwap(myCurr);
259 {
return myFrag->getSwap(myCurr); }
280 GA_Size getSwapCount()
const {
return mySwaps.entries(); }
281 const swapInfo &getSwap(
GA_Size i)
const {
return mySwaps(i); }
283 void packToIndexOrder(
const UT_Options *options);
int compare(const swapInfo &cmp) const
A class to manage an ordered array which has fixed offset handles.
const_iterator begin() const
swapInfo(GA_Size a, GA_Size b, GA_Size n, OPERATION op)
const_iterator & operator++(int)
GLboolean GLboolean GLboolean GLboolean a
bool operator<(const swapInfo &cmp) const
GA_AttributeOwner getOwner() const
bool isEmpty() const
Check if there are any swaps to perform.
exint GA_Size
Defines the bit width for index and offset types in GA.
SYS_FORCE_INLINE bool hasOffsetChanged(GA_Offset old_offset) const
Test to see if an offset will move during the swapping.
const_iterator(const const_iterator &src)
#define GA_INVALID_OFFSET
IMATH_HOSTDEVICE constexpr int cmp(T a, T b) IMATH_NOEXCEPT
const GA_IndexMap & getIndexMap() const
const_iterator & operator=(const const_iterator &src)
const_iterator & operator++()
swapInfo(const swapInfo &i)
Defragmentation of IndexMaps.
GLboolean GLboolean GLboolean b
GA_Offset getOffsetMapEntries() const
Return number of offsets stored in the map.
const_iterator end() const
A map of string to various well defined value types.
GA_Offset getA() const
Get the swap ranges.
swapInfo & operator=(const swapInfo &i)
GA_Offset getMaxOccupiedOffset() const
Return the maximum offset after the defragmentation is complete.
static bool shouldIndexMapBeDefragmented(const GA_IndexMap &map, const UT_Options *options)
static int qsortCompare(const swapInfo *a, const swapInfo *b)
bool operator==(const swapInfo &i) const
bool operator==(const const_iterator &src) const
SYS_FORCE_INLINE GA_Offset mapOffset(GA_Offset old_offset) const
Given the old offset, return the new offset.