Go to the documentation of this file.
37 template <AkMemID T_MEMID>
42 return AkAlloc(T_MEMID, in_uSize);
47 return AkRealloc(T_MEMID, in_pCurrent, in_uNewSize);
52 AkFree(T_MEMID, in_pAddress);
61 template <AkMemID T_MEMID>
76 AkFree(T_MEMID, in_pAddress);
90 template< AkUInt32 uBufferSizeBytes, AkUInt8 uAlignmentSize = 1, AkMemID T_MEMID = AkMemID_Object>
97 if (in_uSize <= uBufferSizeBytes)
98 return (
void *)&m_buffer;
99 return AkMalign(T_MEMID, in_uSize, uAlignmentSize);
104 if (in_uNewSize <= uBufferSizeBytes)
105 return (
void *)&m_buffer;
107 if (&m_buffer != in_pCurrent)
110 void* pAddress =
AkMalign(T_MEMID, in_uNewSize, uAlignmentSize);
120 if (&m_buffer != in_pAddress)
121 AkFree(T_MEMID, in_pAddress);
126 if (&in_srcAlloc.m_buffer == in_pSrc)
137 AK_ALIGN(
char m_buffer[uBufferSizeBytes], uAlignmentSize);
143 template <
class T, AkUInt32 uCount = 1, AkMemID MemID = AkMemID_Object>
171 io_Dest = std::move(io_Src);
186 io_Dest = std::move(io_Src);
201 in_Dest.Transfer(in_Src);
229 template <AkUInt32 uCount>
234 if (in_CurrentArraySize < uCount)
235 return uCount - in_CurrentArraySize;
238 return in_CurrentArraySize + (in_CurrentArraySize >> 1);
247 if ( in_CurrentArraySize == 0 )
250 return in_CurrentArraySize + ( in_CurrentArraySize >> 1 );
255 #define AkGrowByPolicy_DEFAULT AkGrowByPolicy_Proportional
258 template <
class T,
class ARG_T,
class TAlloc = ArrayPoolDefault,
class TGrowBy = AkGrowByPolicy_DEFAULT,
class TMovePolicy = AkAssignmentMovePolicy<T> >
class AkArray :
public TAlloc
342 #endif // #ifndef SWIG
363 Iterator it =
Begin();
365 for ( Iterator itEnd =
End(); it != itEnd; ++it )
367 if ( *it == in_Item )
382 while ( uNumToSearch > 0 )
384 pPivot = pBase + ( uNumToSearch >> 1 );
385 if ( in_Item == *pPivot )
388 result.pItem = pPivot;
392 if ( in_Item > *pPivot )
404 Iterator
Erase( Iterator& in_rIter )
408 if (TMovePolicy::IsTrivial())
410 T* pItem = in_rIter.pItem;
417 if (pItem < pLastItem)
422 (
AkUInt32)(pLastItem - pItem) *
sizeof(T)
431 for (T* pItem = in_rIter.pItem; pItem < pItemLast; pItem++)
432 TMovePolicy::Move(pItem[0], pItem[1]);
444 void Erase(
unsigned int in_uIndex )
448 if (TMovePolicy::IsTrivial())
470 for (T* pItem =
m_pItems + in_uIndex; pItem < pItemLast; pItem++)
471 TMovePolicy::Move(pItem[0], pItem[1]);
489 TMovePolicy::Move( *in_rIter.pItem,
Last( ) );
506 Iterator.pItem =
m_pItems + in_uIndex;
512 return TGrowBy::GrowBy( 1 ) != 0;
537 AKASSERT(!
"AkArray calling Reserve() with AkGrowByPolicy_NoGrow is only allowed when reserved size is zero");
587 Iterator it =
FindEx( in_Item );
588 return ( it !=
End() ) ? it.pItem : 0;
597 #if defined(_MSC_VER)
598 #pragma warning( push )
599 #pragma warning( disable : 4127 )
606 #if defined(_MSC_VER)
607 #pragma warning( pop )
649 Iterator it =
FindEx( in_rItem );
663 Iterator it =
FindEx( in_rItem );
676 for ( Iterator it =
Begin(), itEnd =
End(); it != itEnd; ++it )
699 if (T* ptr =
Insert(index))
718 #if defined(_MSC_VER)
719 #pragma warning( push )
720 #pragma warning( disable : 4127 )
727 #if defined(_MSC_VER)
728 #pragma warning( pop )
734 if (TMovePolicy::IsTrivial())
759 for (T* pItem = pItemLast; pItem > (
m_pItems + in_uIndex); --pItem)
760 TMovePolicy::Move(pItem[0], pItem[-1]);
785 T * pNewItems =
NULL;
789 if (
m_pItems && TMovePolicy::IsTrivial())
791 pNewItems = (T *)TAlloc::ReAlloc(
m_pItems,
sizeof(T) * cItems,
sizeof(T) * ulNewReserve);
797 pNewItems = (T *)TAlloc::Alloc(
sizeof(T) * ulNewReserve);
804 for (
size_t i = 0; i < cItems; ++i)
808 TMovePolicy::Move(pNewItems[i],
m_pItems[i]);
826 if (in_uiSize < cItems)
828 for (
AkUInt32 i = in_uiSize; i < cItems; i++)
844 for(
size_t i = cItems; i < in_uiSize; i++)
857 TAlloc::TransferMem( (
void*&)
m_pItems, in_rSource, (
void*)in_rSource.
m_pItems );
void EraseSwap(unsigned int in_uIndex)
static AkForceInline void TransferMem(void *&io_pDest, AkArrayAllocatorNoAlign< T_MEMID > in_srcAlloc, void *in_pSrc)
AkForceInline void TransferMem(void *&io_pDest, AkHybridAllocator< uBufferSizeBytes, uAlignmentSize, T_MEMID > &in_srcAlloc, void *in_pSrc)
AkUInt32 operator-(Iterator const &rhs) const
AkForceInline void * Alloc(size_t in_uSize)
AkForceInline void Free(void *in_pAddress)
Iterator & operator++()
++ operator
static const AkUInt32 _uBufferSizeBytes
AkForceInline void AkMemMove(void *pDest, const void *pSrc, AkUInt32 uSize)
@ AK_Fail
The operation failed.
bool IsGrowingAllowed() const
AkForceInline void * ReAlloc(void *in_pCurrent, size_t in_uOldSize, size_t in_uNewSize)
AKRESULT Copy(const AkArray< T, ARG_T, TAlloc, TGrowBy, TMovePolicy > &in_rSource)
Iterator FindEx(ARG_T in_Item) const
Returns the iterator th the specified item, will be End() if the item is not found.
#define AkPlacementNew(_memory)
void RemoveAll()
Removes all items in the array.
#define AkFree(_pool, _pvmem)
AKSOUNDENGINE_API void Free(AkMemPoolId in_poolId, void *in_pMemAddress)
AK_ALIGN(char m_buffer[uBufferSizeBytes], uAlignmentSize)
T & Last()
Returns a reference to the last item in the array.
AKRESULT
Standard function call result.
AkForceInline void * ReAlloc(void *in_pCurrent, size_t in_uOldSize, size_t in_uNewSize)
AKRESULT RemoveSwap(ARG_T in_rItem)
AkArrayAllocatorAlignedSimd< AkMemID_Processing > ArrayPoolLEngineDefaultAlignedSimd
AkForceInline void Free(void *in_pAddress)
static AkUInt32 GrowBy(AkUInt32 in_CurrentArraySize)
AkForceInline T * Exists(ARG_T in_Item) const
Returns a pointer to the specified item in the list if it exists, 0 if not found.
Specific implementation of array.
#define AkAlloc(_pool, _size)
static AkForceInline bool IsTrivial()
T * pItem
Pointer to the item in the array.
@ AK_Success
The operation was successful.
bool GrowArray(AkUInt32 in_uGrowBy)
Resize the array.
AkArrayAllocatorNoAlign< AkMemID_Profiler > ArrayPoolProfiler
AkArrayAllocatorNoAlign< AkMemID_Processing > ArrayPoolLEngineDefault
AkForceInline void TransferMem(void *&io_pDest, AkArrayAllocatorAlignedSimd< T_MEMID > in_srcAlloc, void *in_pSrc)
bool operator==(const Iterator &in_rOp) const
== operator
void RemoveLast()
Removes the last item from the array.
@ AK_InvalidParameter
Something is not within bounds, check the documentation of the function returning this code.
static AkForceInline void * Alloc(size_t in_uSize)
AkUInt32 m_uLength
number of items in the array.
bool Resize(AkUInt32 in_uiSize)
Resize the array to the specified size.
AkForceInline T * AddLast(ARG_T in_rItem)
Add an item in the array, and fills it with the provided item.
#define AKASSERT(Condition)
static AkUInt32 GrowBy(AkUInt32)
static AkForceInline void * ReAlloc(void *in_pCurrent, size_t in_uOldSize, size_t in_uNewSize)
AKRESULT ReserveExtra(AkUInt32 in_ulReserve)
AkForceInline void AkMemCpy(void *pDest, const void *pSrc, AkUInt32 uSize)
Platform Independent Helper for memcpy/memmove/memset.
Iterator End() const
Returns the iterator to the end of the array.
AkUInt32 Reserved() const
Iterator Insert(Iterator &in_rIter)
AkForceInline void * Alloc(size_t in_uSize)
void Transfer(AkArray< T, ARG_T, TAlloc, TGrowBy, TMovePolicy > &in_rSource)
Iterator Erase(Iterator &in_rIter)
Erase the specified iterator from the array.
static AkForceInline void Move(T &in_Dest, T &in_Src)
#define AkMalign(_pool, _size, _align)
AkUInt32 m_ulReserved
how many we can have at most (currently allocated).
Iterator Begin() const
Returns the iterator to the first item of the array, will be End() if the array is empty.
AkForceInline AkUInt32 Length() const
Returns the numbers of items in the array.
static AkForceInline bool IsTrivial()
#define AkRealloc(_pool, _pvmem, _size)
AkArrayAllocatorNoAlign< AkMemID_Object > ArrayPoolDefault
AKRESULT Remove(ARG_T in_rItem)
Removes the specified item if found in the array.
void Erase(unsigned int in_uIndex)
Erase the item at the specified index.
bool operator!=(const Iterator &in_rOp) const
!= operator
AkForceInline T * AddLast()
static AkForceInline void Free(void *in_pAddress)
uint32_t AkUInt32
Unsigned 32-bit integer.
void Term()
Term the array. Must be called before destroying the object.
static AkForceInline bool IsTrivial()
@ AK_InsufficientMemory
Memory error.
static AkUInt32 GrowBy(AkUInt32 in_CurrentArraySize)
static AkUInt32 GrowBy(AkUInt32)
AkForceInline bool IsEmpty() const
Returns true if the number items in the array is 0, false otherwise.
static AkForceInline void Move(T &in_Dest, T &in_Src)
AkForceInline T * Data() const
Returns a pointer to the first item in the array.
T * Insert(unsigned int in_uIndex)
Iterator & operator--()
– operator
Iterator EraseSwap(Iterator &in_rIter)
AkForceInline T & operator[](unsigned int uiIndex) const
Operator [], return a reference to the specified index.
#define AkReallocAligned(_pool, _pvmem, _size, _align)
AKRESULT Reserve(AkUInt32 in_ulReserve)
Iterator operator+(AkUInt32 inc) const
static AkForceInline void Move(T &&io_Dest, T &&io_Src)
Iterator BinarySearch(ARG_T in_Item) const
T * m_pItems
pointer to the beginning of the array.
static AkForceInline void Move(T &&io_Dest, T &&io_Src)
static AkForceInline bool IsTrivial()
Besoin d'aide ?
Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !
Visitez notre page d'Aide
Décrivez-nous de votre projet. Nous sommes là pour vous aider.
Enregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !
Partir du bon pied avec Wwise