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>
74 AkFree(T_MEMID, in_pAddress);
88 template< AkUInt32 uBufferSizeBytes, AkUInt8 uAlignmentSize = 1, AkMemID T_MEMID = AkMemID_Object>
95 if (in_uSize <= uBufferSizeBytes)
96 return (
void *)&m_buffer;
97 return AkMalign(T_MEMID, in_uSize, uAlignmentSize);
102 if (in_uNewSize <= uBufferSizeBytes)
103 return (
void *)&m_buffer;
105 if (&m_buffer != in_pCurrent)
108 void* pAddress =
AkMalign(T_MEMID, in_uNewSize, uAlignmentSize);
118 if (&m_buffer != in_pAddress)
119 AkFree(T_MEMID, in_pAddress);
124 if (&in_srcAlloc.m_buffer == in_pSrc)
135 AK_ALIGN(
char m_buffer[uBufferSizeBytes], uAlignmentSize);
160 in_Dest.Transfer(in_Src);
188 if ( in_CurrentArraySize == 0 )
191 return in_CurrentArraySize + ( in_CurrentArraySize >> 1 );
196 #define AkGrowByPolicy_DEFAULT AkGrowByPolicy_Proportional
199 template <
class T,
class ARG_T,
class TAlloc = ArrayPoolDefault,
class TGrowBy = AkGrowByPolicy_DEFAULT,
class TMovePolicy = AkAssignmentMovePolicy<T> >
class AkArray :
public TAlloc
283 #endif // #ifndef SWIG
304 Iterator it =
Begin();
306 for ( Iterator itEnd =
End(); it != itEnd; ++it )
308 if ( *it == in_Item )
323 while ( uNumToSearch > 0 )
325 pPivot = pBase + ( uNumToSearch >> 1 );
326 if ( in_Item == *pPivot )
329 result.pItem = pPivot;
333 if ( in_Item > *pPivot )
345 Iterator
Erase( Iterator& in_rIter )
353 for ( T * pItem = in_rIter.pItem; pItem < pItemLast; pItem++ )
354 TMovePolicy::Move( pItem[ 0 ], pItem[ 1 ] );
366 void Erase(
unsigned int in_uIndex )
374 for ( T * pItem =
m_pItems+in_uIndex; pItem < pItemLast; pItem++ )
375 TMovePolicy::Move( pItem[ 0 ], pItem[ 1 ] );
393 TMovePolicy::Move( *in_rIter.pItem,
Last( ) );
410 Iterator.pItem =
m_pItems + in_uIndex;
416 return TGrowBy::GrowBy( 1 ) != 0;
427 m_pItems = (T *) TAlloc::Alloc(
sizeof( T ) * in_ulReserve );
472 Iterator it =
FindEx( in_Item );
473 return ( it !=
End() ) ? it.pItem : 0;
482 #if defined(_MSC_VER)
483 #pragma warning( push )
484 #pragma warning( disable : 4127 )
491 #if defined(_MSC_VER)
492 #pragma warning( pop )
534 Iterator it =
FindEx( in_rItem );
548 Iterator it =
FindEx( in_rItem );
561 for ( Iterator it =
Begin(), itEnd =
End(); it != itEnd; ++it )
582 #if defined(_MSC_VER)
583 #pragma warning( push )
584 #pragma warning( disable : 4127 )
591 #if defined(_MSC_VER)
592 #pragma warning( pop )
603 for ( T * pItem = pItemLast; pItem > (
m_pItems + in_uIndex ); --pItem )
604 TMovePolicy::Move( pItem[ 0 ], pItem[ -1 ] );
629 T * pNewItems =
NULL;
631 if (TMovePolicy::IsTrivial())
633 pNewItems = (T *)TAlloc::ReAlloc(
m_pItems,
sizeof(T) * cItems,
sizeof(T) * ulNewReserve);
639 pNewItems = (T *)TAlloc::Alloc(
sizeof(T) * ulNewReserve);
646 for (
size_t i = 0; i < cItems; ++i)
650 TMovePolicy::Move(pNewItems[i],
m_pItems[i]);
668 if (in_uiSize < cItems)
671 for(
AkUInt32 i = in_uiSize - 1 ; i < cItems; i++)
686 for(
size_t i = cItems; i < in_uiSize; i++)
699 TAlloc::TransferMem( (
void*&)
m_pItems, in_rSource, (
void*)in_rSource.
m_pItems );