35 template <AkMemID T_MEMID>
40 return AkAlloc(T_MEMID, in_uSize);
45 return AkRealloc(T_MEMID, in_pCurrent, in_uNewSize);
50 AkFree(T_MEMID, in_pAddress);
59 template <AkMemID T_MEMID>
69 void* pNew =
Alloc(in_uNewSize);
70 if (pNew && in_pCurrent)
94 template< AkUInt32 uBufferSizeBytes, AkUInt8 uAlignmentSize = AK_OS_STRUCT_ALIGN, AkMemID T_MEMID = AkMemID_Object>
101 if (in_uSize <= uBufferSizeBytes)
102 return (
void *)&m_buffer;
104 return AkMalign(T_MEMID, in_uSize, uAlignmentSize);
109 void* pNew =
Alloc(in_uNewSize);
110 if (pNew != in_pCurrent && pNew && in_pCurrent)
120 if (&m_buffer != in_pAddress)
126 if (&in_srcAlloc.m_buffer == in_pSrc)
137 AK_ALIGN(
char m_buffer[uBufferSizeBytes], uAlignmentSize);
162 in_Dest.Transfer(in_Src);
190 if ( in_CurrentArraySize == 0 )
193 return in_CurrentArraySize + ( in_CurrentArraySize >> 1 );
198 #define AkGrowByPolicy_DEFAULT AkGrowByPolicy_Proportional
201 template <
class T,
class ARG_T,
class TAlloc = ArrayPoolDefault,
class TGrowBy = AkGrowByPolicy_DEFAULT,
class TMovePolicy = AkAssignmentMovePolicy<T> >
class AkArray :
public TAlloc
279 #endif // #ifndef SWIG
300 Iterator it =
Begin();
302 for ( Iterator itEnd =
End(); it != itEnd; ++it )
304 if ( *it == in_Item )
319 while ( uNumToSearch > 0 )
321 pPivot = pBase + ( uNumToSearch >> 1 );
322 if ( in_Item == *pPivot )
325 result.pItem = pPivot;
329 if ( in_Item > *pPivot )
341 Iterator
Erase( Iterator& in_rIter )
349 for ( T * pItem = in_rIter.pItem; pItem < pItemLast; pItem++ )
350 TMovePolicy::Move( pItem[ 0 ], pItem[ 1 ] );
362 void Erase(
unsigned int in_uIndex )
370 for ( T * pItem =
m_pItems+in_uIndex; pItem < pItemLast; pItem++ )
371 TMovePolicy::Move( pItem[ 0 ], pItem[ 1 ] );
389 TMovePolicy::Move( *in_rIter.pItem,
Last( ) );
403 return TGrowBy::GrowBy( 1 ) != 0;
414 m_pItems = (T *) TAlloc::Alloc(
sizeof( T ) * in_ulReserve );
459 Iterator it =
FindEx( in_Item );
460 return ( it !=
End() ) ? it.pItem : 0;
469 #if defined(_MSC_VER)
470 #pragma warning( push )
471 #pragma warning( disable : 4127 )
478 #if defined(_MSC_VER)
479 #pragma warning( pop )
521 Iterator it =
FindEx( in_rItem );
535 Iterator it =
FindEx( in_rItem );
548 for ( Iterator it =
Begin(), itEnd =
End(); it != itEnd; ++it )
569 #if defined(_MSC_VER)
570 #pragma warning( push )
571 #pragma warning( disable : 4127 )
578 #if defined(_MSC_VER)
579 #pragma warning( pop )
590 for ( T * pItem = pItemLast; pItem > (
m_pItems + in_uIndex ); --pItem )
591 TMovePolicy::Move( pItem[ 0 ], pItem[ -1 ] );
616 T * pNewItems =
NULL;
618 if (TMovePolicy::IsTrivial())
620 pNewItems = (T *)TAlloc::ReAlloc(
m_pItems,
sizeof(T) * cItems,
sizeof(T) * ulNewReserve);
626 pNewItems = (T *)TAlloc::Alloc(
sizeof(T) * ulNewReserve);
633 for (
size_t i = 0; i < cItems; ++i)
637 TMovePolicy::Move(pNewItems[i],
m_pItems[i]);
655 if (in_uiSize < cItems)
658 for(
AkUInt32 i = in_uiSize - 1 ; i < cItems; i++)
673 for(
size_t i = cItems; i < in_uiSize; i++)
686 TAlloc::TransferMem( (
void*&)
m_pItems, in_rSource, (
void*)in_rSource.
m_pItems );