354 if (uIdx
356 T_ITEM * pSecondNextItem = this->
m_pItems + (uIdx + 2);
357 if (
Lesser(in_NewKey, U_KEY::Get(*pSecondNextItem)))
359 return Swap(pNextItem, pItem);
363 bNeedReordering =
true;
368 return Swap(pNextItem, pItem);
378 unsigned int uIdxToInsert;
382 uIdxToInsert = (
unsigned int)(pTargetItem - this->
m_pItems);
383 if (uIdxToInsert > uIdx)
390 uIdxToInsert = uLastIdx;
393 T_ITEM * pStartItem = this->
m_pItems + uIdx;
394 T_ITEM * pEndItem = this->
m_pItems + uIdxToInsert;
395 if (uIdxToInsert
398 while (pStartItem != pEndItem)
401 pStartItem[1] = pStartItem[0];
407 while (pStartItem != pEndItem)
409 pStartItem[0] = pStartItem[1];
413 pEndItem[0] = in_item;
423 if (NumItemsToReInsert != 0)
427 T_ITEM * pReinsertionItem = this->
m_pItems;
429 for (
AkInt32 idx = 0; idx
431 T_ITEM ItemtoReinsert = pReinsertionItem[idx];
433 T_KEY keyToReinsert = U_KEY::Get(ItemtoReinsert);
435 T_ITEM* pInsertionEmplacement =
AddNoSetKey(keyToReinsert);
438 *pInsertionEmplacement = ItemtoReinsert;
450 while ( uNumToSearch > 0 )
452 iPivot = iBase + ( uNumToSearch >> 1 );
453 T_KEY pivotKey = U_KEY::Get( this->
m_pItems[ iPivot ] );
454 if (
Equal( pivotKey, in_key ) )
460 if (
Lesser( pivotKey, in_key ) )
481 AKASSERT(in_to.pItem >= in_from.pItem);
486 while (uNumToSearch > 0)
488 uPivot = uBase + (
AkUInt32)(uNumToSearch >> 1);
489 T_KEY pivotKey = U_KEY::Get(this->
m_pItems[uPivot]);
490 if (
Lesser(pivotKey, in_key))
503 T_ITEM ItemTemp = *in_ItemA;
504 *in_ItemA = *in_ItemB;
505 *in_ItemB = ItemTemp;
510 #endif //_KEYARRAY_H_
T_ITEM * Exists(T_KEY in_Key) const
T_ITEM * Set(T_KEY in_Key, const T_ITEM &in_Item)
AkArray, const MapStruct &, U_POOL, TGrowBy, TMovePolicy >::Iterator FindEx(T_KEY in_Item) const
T_ITEM * Set(T_KEY in_key, bool &out_bExists)
T_ITEM * Set(T_KEY in_Key)
Key policy for AkSortedKeyArray.
T_ITEM * LowerBounds(T_KEY in_key, Iterator in_from, Iterator in_to) const
T_ITEM * Exists(T_KEY in_key) const
T_ITEM * LowerBounds(T_KEY in_key) const
Specific implementation of array
int32_t AkInt32
Signed 32-bit integer
T_ITEM * BinarySearch(T_KEY in_key, bool &out_bFound) const
AkUInt32 m_uLength
number of items in the array.
T_ITEM * AddNoSetKey(T_KEY in_key, bool &out_bFound)
AkForceInline void Swap(T_ITEM *in_ItemA, T_ITEM *in_ItemB)
#define AKASSERT(Condition)
T_ITEM * SetFirst(T_KEY in_Key, const T_ITEM &in_Item)
Iterator End() const
Returns the iterator to the end of the array
Iterator Insert(Iterator &in_rIter)
Trivial key policy for AkSortedKeyArray, when T_KEY is T_ITEM.
AkForceInline bool Equal(T_KEY &a, T_KEY &b) const
T_ITEM * Add(T_KEY in_key)
static AkForceInline bool Lesser(THIS_CLASS *, T_KEY &a, T_KEY &b)
Iterator Erase(Iterator &in_rIter)
Erase the specified iterator from the array
Iterator Begin() const
Returns the iterator to the first item of the array, will be End() if the array is empty.
int64_t AkInt64
Signed 64-bit integer
AkForceInline AkUInt32 Length() const
Returns the numbers of items in the array.
static AkForceInline T_KEY & Get(T_ITEM &in_item)
Default policy.
AkForceInline MapStruct * AddLast()
static AkForceInline bool Equal(THIS_CLASS *, T_KEY &a, T_KEY &b)
static AkForceInline T_KEY & Get(T_ITEM &in_item)
Default policy.
uint32_t AkUInt32
Unsigned 32-bit integer
T_ITEM * AddNoSetKey(T_KEY in_key)
void UnsetSwap(T_KEY in_Key)
AkForceInline bool Lesser(T_KEY &a, T_KEY &b) const
typename base::Iterator Iterator
static AkForceInline T_KEY & Get(T_KEY &in_item)
Default policy.
void Reorder(T_KEY in_OldKey, T_KEY in_NewKey, const T_ITEM &in_item)
Iterator EraseSwap(Iterator &in_rIter)
T_ITEM * Set(T_KEY in_key)
T_ITEM * m_pItems
pointer to the beginning of the array.