Warning: you were redirected to the latest documentation corresponding to your major release ( 2024.1.1.8691 ). Should you wish to access your specific version's documentation, please download the offline documentation from the Audiokinetic Launcher and check the Offline Documentation option in Wwise Authoring.
Go to the documentation of this file.
37 template <AkMemID T_MEMID>
42 return AkAlloc(T_MEMID, in_uSize);
48 return AkRealloc(T_MEMID, in_pCurrent, in_uNewSize);
53 AkFree(T_MEMID, in_pAddress);
62 template <AkMemID T_MEMID>
77 AkFree(T_MEMID, in_pAddress);
91 template< AkUInt32 uBufferSizeBytes, AkUInt8 uAlignmentSize = 1, AkMemID T_MEMID = AkMemID_Object>
98 if (in_uSize <= uBufferSizeBytes)
99 return (
void *)&m_buffer;
100 return AkMalign(T_MEMID, in_uSize, uAlignmentSize);
105 if (in_uNewSize <= uBufferSizeBytes)
106 return (
void *)&m_buffer;
108 if (&m_buffer != in_pCurrent)
111 void* pAddress =
AkMalign(T_MEMID, in_uNewSize, uAlignmentSize);
121 if (&m_buffer != in_pAddress)
122 AkFree(T_MEMID, in_pAddress);
127 if (&in_srcAlloc.m_buffer == in_pSrc)
138 AK_ALIGN(
char m_buffer[uBufferSizeBytes], uAlignmentSize);
144 template <
class T, AkUInt32 uCount = 1, AkMemID MemID = AkMemID_Object>
172 io_Dest = std::move(io_Src);
187 io_Dest = std::move(io_Src);
202 in_Dest.Transfer(in_Src);
230 template <AkUInt32 uCount>
235 if (in_CurrentArraySize < uCount)
236 return uCount - in_CurrentArraySize;
239 return in_CurrentArraySize + (in_CurrentArraySize >> 1);
248 if ( in_CurrentArraySize == 0 )
251 return in_CurrentArraySize + ( in_CurrentArraySize >> 1 );
256 #define AkGrowByPolicy_DEFAULT AkGrowByPolicy_Proportional
259 template <
class T,
class ARG_T,
class TAlloc = ArrayPoolDefault,
class TGrowBy = AkGrowByPolicy_DEFAULT,
class TMovePolicy = AkAssignmentMovePolicy<T> >
class AkArray :
public TAlloc
343 #endif // #ifndef SWIG
364 Iterator it =
Begin();
366 for ( Iterator itEnd =
End(); it != itEnd; ++it )
368 if ( *it == in_Item )
383 while ( uNumToSearch > 0 )
385 pPivot = pBase + ( uNumToSearch >> 1 );
386 if ( in_Item == *pPivot )
389 result.pItem = pPivot;
393 if ( in_Item > *pPivot )
405 Iterator
Erase( Iterator& in_rIter )
409 if (TMovePolicy::IsTrivial())
411 T* pItem = in_rIter.pItem;
418 if (pItem < pLastItem)
423 (
AkUInt32)(pLastItem - pItem) *
sizeof(T)
432 for (T* pItem = in_rIter.pItem; pItem < pItemLast; pItem++)
433 TMovePolicy::Move(pItem[0], pItem[1]);
445 void Erase(
unsigned int in_uIndex )
449 if (TMovePolicy::IsTrivial())
471 for (T* pItem =
m_pItems + in_uIndex; pItem < pItemLast; pItem++)
472 TMovePolicy::Move(pItem[0], pItem[1]);
490 TMovePolicy::Move( *in_rIter.pItem,
Last( ) );
507 Iterator.pItem =
m_pItems + in_uIndex;
513 return TGrowBy::GrowBy( 1 ) != 0;
538 AKASSERT(!
"AkArray calling Reserve() with AkGrowByPolicy_NoGrow is only allowed when reserved size is zero");
588 Iterator it =
FindEx( in_Item );
589 return ( it !=
End() ) ? it.pItem : 0;
598 #if defined(_MSC_VER)
599 #pragma warning( push )
600 #pragma warning( disable : 4127 )
607 #if defined(_MSC_VER)
608 #pragma warning( pop )
650 Iterator it =
FindEx( in_rItem );
664 Iterator it =
FindEx( in_rItem );
677 for ( Iterator it =
Begin(), itEnd =
End(); it != itEnd; ++it )
700 if (T* ptr =
Insert(index))
719 #if defined(_MSC_VER)
720 #pragma warning( push )
721 #pragma warning( disable : 4127 )
728 #if defined(_MSC_VER)
729 #pragma warning( pop )
735 if (TMovePolicy::IsTrivial())
760 for (T* pItem = pItemLast; pItem > (
m_pItems + in_uIndex); --pItem)
761 TMovePolicy::Move(pItem[0], pItem[-1]);
786 T * pNewItems =
NULL;
790 if (
m_pItems && TMovePolicy::IsTrivial())
792 pNewItems = (T *)TAlloc::ReAlloc(
m_pItems,
sizeof(T) * cItems,
sizeof(T) * ulNewReserve);
798 pNewItems = (T *)TAlloc::Alloc(
sizeof(T) * ulNewReserve);
805 for (
size_t i = 0; i < cItems; ++i)
809 TMovePolicy::Move(pNewItems[i],
m_pItems[i]);
827 if (in_uiSize < cItems)
829 for (
AkUInt32 i = in_uiSize; i < cItems; i++)
845 for(
size_t i = cItems; i < in_uiSize; i++)
858 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()
Tell us about your project. We're here to help.
Register your project and we'll help you get started with no strings attached!
Get started with Wwise