Table of Contents

Wwise SDK 2019.1.5
AkArray.h
Go to the documentation of this file.
1 /*******************************************************************************
2 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
3 released in source code form as part of the SDK installer package.
4 
5 Commercial License Usage
6 
7 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
8 may use this file in accordance with the end user license agreement provided
9 with the software or, alternatively, in accordance with the terms contained in a
10 written agreement between you and Audiokinetic Inc.
11 
12 Apache License Usage
13 
14 Alternatively, this file may be used under the Apache License, Version 2.0 (the
15 "Apache License"); you may not use this file except in compliance with the
16 Apache License. You may obtain a copy of the Apache License at
17 http://www.apache.org/licenses/LICENSE-2.0.
18 
19 Unless required by applicable law or agreed to in writing, software distributed
20 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
21 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
22 the specific language governing permissions and limitations under the License.
23 
24  Version: <VERSION> Build: <BUILDNUMBER>
25  Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
26 *******************************************************************************/
27 
28 #ifndef _AKARRAY_H
29 #define _AKARRAY_H
30 
34 
35 #define AK_DEFINE_ARRAY_POOL( _name_, _poolID_ ) \
36 struct _name_ \
37 { \
38  static AkMemPoolId Get() \
39  { \
40  return _poolID_; \
41  } \
42 };
43 
44 AK_DEFINE_ARRAY_POOL( _ArrayPoolDefault, g_DefaultPoolId )
45 AK_DEFINE_ARRAY_POOL( _ArrayPoolLEngineDefault, g_LEngineDefaultPoolId )
46 
47 template <class U_POOL>
49 {
50  AkForceInline void * Alloc( size_t in_uSize )
51  {
52  return AK::MemoryMgr::Malloc( U_POOL::Get(), in_uSize );
53  }
54 
55  AkForceInline void * ReAlloc( void * in_pCurrent, size_t in_uOldSize, size_t in_uNewSize )
56  {
57  return AK::MemoryMgr::Realloc(U_POOL::Get(), in_pCurrent, in_uNewSize);
58  }
59 
60  AkForceInline void Free( void * in_pAddress )
61  {
62  AK::MemoryMgr::Free( U_POOL::Get(), in_pAddress );
63  }
64 
65  AkForceInline void TransferMem(void *& io_pDest, AkArrayAllocatorNoAlign<U_POOL> in_srcAlloc, void * in_pSrc )
66  {
67  io_pDest = in_pSrc;
68  }
69 };
70 
71 template <class U_POOL>
73 {
74  AkForceInline void * Alloc( size_t in_uSize )
75  {
76  return AK::MemoryMgr::Malign( U_POOL::Get(), in_uSize, AK_SIMD_ALIGNMENT );
77  }
78 
79  AkForceInline void * ReAlloc(void * in_pCurrent, size_t in_uOldSize, size_t in_uNewSize)
80  {
81  void* pNew = Alloc(in_uNewSize);
82  if (pNew && in_pCurrent)
83  {
84  AKPLATFORM::AkMemCpy(pNew, in_pCurrent, (AkUInt32)in_uOldSize);
85  Free(in_pCurrent);
86  }
87  return pNew;
88  }
89 
90  AkForceInline void Free( void * in_pAddress )
91  {
92  AK::MemoryMgr::Falign( U_POOL::Get(), in_pAddress );
93  }
94 
95  AkForceInline void TransferMem(void *& io_pDest, AkArrayAllocatorAlignedSimd<U_POOL> in_srcAlloc, void * in_pSrc )
96  {
97  io_pDest = in_pSrc;
98  }
99 
100 };
101 
102 // AkHybridAllocator
103 // Attempts to allocate from a small buffer of size uBufferSizeBytes, which is contained within the array type. Useful if the array is expected to contain a small number of elements.
104 // If the array grows to a larger size than uBufferSizeBytes, the the memory is allocated from the default memory pool.
105 // NOTE: only use with types that are trivially copyable.
106 template< AkUInt32 uBufferSizeBytes, AkUInt8 uAlignmentSize = AK_OS_STRUCT_ALIGN>
108 {
109  static const AkUInt32 _uBufferSizeBytes = uBufferSizeBytes;
110 
111  AkForceInline void * Alloc(size_t in_uSize)
112  {
113  if (in_uSize <= uBufferSizeBytes)
114  return (void *)&m_buffer;
115  else
116  return AK::MemoryMgr::Malign(g_DefaultPoolId, in_uSize, uAlignmentSize);
117  }
118 
119  AkForceInline void * ReAlloc( void * in_pCurrent, size_t in_uOldSize, size_t in_uNewSize )
120  {
121  void* pNew = Alloc(in_uNewSize);
122  if (pNew != in_pCurrent && pNew && in_pCurrent)
123  {
124  AKPLATFORM::AkMemCpy(pNew, in_pCurrent, (AkUInt32)in_uOldSize);
125  Free(in_pCurrent);
126  }
127  return pNew;
128  }
129 
130  AkForceInline void Free(void * in_pAddress)
131  {
132  if (&m_buffer != in_pAddress)
134  }
135 
136  AkForceInline void TransferMem(void *& io_pDest, AkHybridAllocator<uBufferSizeBytes, uAlignmentSize>& in_srcAlloc, void * in_pSrc)
137  {
138  if (&in_srcAlloc.m_buffer == in_pSrc)
139  {
140  AKPLATFORM::AkMemCpy(m_buffer, in_srcAlloc.m_buffer, uBufferSizeBytes);
141  io_pDest = m_buffer;
142  }
143  else
144  {
145  io_pDest = in_pSrc;
146  }
147  }
148 
149  AK_ALIGN(char m_buffer[uBufferSizeBytes], uAlignmentSize);
150 };
151 
152 template <class T>
154 {
155  // By default the assignment operator is invoked to move elements of an array from slot to slot. If desired,
156  // a custom 'Move' operation can be passed into TMovePolicy to transfer ownership of resources from in_Src to in_Dest.
157  static AkForceInline void Move( T& in_Dest, T& in_Src )
158  {
159  in_Dest = in_Src;
160  }
161 
162  static AkForceInline bool IsTrivial()
163  {
164  return true;
165  }
166 };
167 
168 // Can be used as TMovePolicy to create arrays of arrays.
169 template <class T>
171 {
172  static AkForceInline void Move( T& in_Dest, T& in_Src )
173  {
174  in_Dest.Transfer(in_Src); //transfer ownership of resources.
175  }
176 
177  static AkForceInline bool IsTrivial()
178  {
179  return false;
180  }
181 };
182 
183 // Common allocators:
187 
188 /// Specific implementation of array
189 template <class T, class ARG_T, class TAlloc = ArrayPoolDefault, unsigned long TGrowBy = 1, class TMovePolicy = AkAssignmentMovePolicy<T> > class AkArray : public TAlloc
190 {
191 public:
192  /// Constructor
194  : m_pItems( 0 )
195  , m_uLength( 0 )
196  , m_ulReserved( 0 )
197  {
198  }
199 
200  /// Destructor
202  {
203  AKASSERT( m_pItems == 0 );
204  AKASSERT( m_uLength == 0 );
205  AKASSERT( m_ulReserved == 0 );
206  }
207 
208 // Workaround for SWIG to parse nested structure:
209 // Bypass this inner struct and use a proxy in a separate header.
210 #ifndef SWIG
211  /// Iterator
212  struct Iterator
213  {
214  T* pItem; ///< Pointer to the item in the array.
215 
216  /// + operator</span>
218  {
219  AKASSERT( pItem );
220  Iterator returnedIt;
221  returnedIt.pItem = pItem + inc;
222  return returnedIt;
223  }
224 
225  /// - operator</span>
226  AkUInt32 operator-(Iterator const& rhs) const
227  {
228  AKASSERT((pItem && rhs.pItem)||(!pItem && !rhs.pItem));
229  return (AkUInt32)(pItem - rhs.pItem);
230  }
231 
232  /// ++ operator</span>
234  {
235  AKASSERT( pItem );
236  ++pItem;
237  return *this;
238  }
239 
240  /// -- operator</span>
242  {
243  AKASSERT( pItem );
244  --pItem;
245  return *this;
246  }
247 
248  /// * operator</span>
250  {
251  AKASSERT( pItem );
252  return *pItem;
253  }
254 
255  /// == operator</span>
256  bool operator ==( const Iterator& in_rOp ) const
257  {
258  return ( pItem == in_rOp.pItem );
259  }
260 
261  /// != operator</span>
262  bool operator !=( const Iterator& in_rOp ) const
263  {
264  return ( pItem != in_rOp.pItem );
265  }
266  };
267 #endif // #ifndef SWIG
268 
269  /// Returns the iterator to the first item of the array, will be End() if the array is empty.
270  Iterator Begin() const
271  {
272  Iterator returnedIt;
273  returnedIt.pItem = m_pItems;
274  return returnedIt;
275  }
276 
277  /// Returns the iterator to the end of the array
278  Iterator End() const
279  {
280  Iterator returnedIt;
281  returnedIt.pItem = m_pItems + m_uLength;
282  return returnedIt;
283  }
284 
285  /// Returns the iterator th the specified item, will be End() if the item is not found
286  Iterator FindEx( ARG_T in_Item ) const
287  {
288  Iterator it = Begin();
289 
290  for ( Iterator itEnd = End(); it != itEnd; ++it )
291  {
292  if ( *it == in_Item )
293  break;
294  }
295 
296  return it;
297  }
298 
299  /// Returns the iterator th the specified item, will be End() if the item is not found
300  /// The array must be in ascending sorted order.
301  Iterator BinarySearch( ARG_T in_Item ) const
302  {
303  Iterator itResult = End();
304  if (m_pItems)
305  {
306  T * pTop = m_pItems, * pBottom = m_pItems + m_uLength;
307 
308  while ( pTop <= pBottom )
309  {
310  T* pThis = ( pBottom - pTop ) / 2 + pTop;
311  if( in_Item < *pThis )
312  pBottom = pThis - 1;
313  else if ( in_Item > *pThis )
314  pTop = pThis + 1;
315  else
316  {
317  itResult.pItem = pThis;
318  break;
319  }
320  }
321  }
322 
323  return itResult;
324  }
325 
326  /// Erase the specified iterator from the array
327  Iterator Erase( Iterator& in_rIter )
328  {
329  AKASSERT( m_pItems != 0 );
330 
331  // Move items by 1
332 
333  T * pItemLast = m_pItems + m_uLength - 1;
334 
335  for ( T * pItem = in_rIter.pItem; pItem < pItemLast; pItem++ )
336  TMovePolicy::Move( pItem[ 0 ], pItem[ 1 ] );
337 
338  // Destroy the last item
339 
340  pItemLast->~T();
341 
342  m_uLength--;
343 
344  return in_rIter;
345  }
346 
347  /// Erase the item at the specified index
348  void Erase( unsigned int in_uIndex )
349  {
350  AKASSERT( m_pItems != 0 );
351 
352  // Move items by 1
353 
354  T * pItemLast = m_pItems + m_uLength - 1;
355 
356  for ( T * pItem = m_pItems+in_uIndex; pItem < pItemLast; pItem++ )
357  TMovePolicy::Move( pItem[ 0 ], pItem[ 1 ] );
358 
359  // Destroy the last item
360 
361  pItemLast->~T();
362 
363  m_uLength--;
364  }
365 
366  /// Erase the specified iterator in the array. but it dos not guarantee the ordering in the array.
367  /// This version should be used only when the order in the array is not an issue.
368  Iterator EraseSwap( Iterator& in_rIter )
369  {
370  AKASSERT( m_pItems != 0 );
371 
372  if ( Length( ) > 1 )
373  {
374  // Swap last item with this one.
375  TMovePolicy::Move( *in_rIter.pItem, Last( ) );
376  }
377 
378  // Destroy.
379  AKASSERT( Length( ) > 0 );
380  Last( ).~T();
381 
382  m_uLength--;
383 
384  return in_rIter;
385  }
386 
387  /// Pre-Allocate a number of spaces in the array
388  AKRESULT Reserve( AkUInt32 in_ulReserve )
389  {
390  AKASSERT( m_pItems == 0 && m_uLength == 0 );
391  AKASSERT( in_ulReserve || TGrowBy );
392 
393  if ( in_ulReserve )
394  {
395  m_pItems = (T *) TAlloc::Alloc( sizeof( T ) * in_ulReserve );
396  if ( m_pItems == 0 )
397  return AK_InsufficientMemory;
398 
399  m_ulReserved = in_ulReserve;
400  }
401 
402  return AK_Success;
403  }
404 
405  AkUInt32 Reserved() const { return m_ulReserved; }
406 
407  /// Term the array. Must be called before destroying the object.
408  void Term()
409  {
410  if ( m_pItems )
411  {
412  RemoveAll();
414  m_pItems = 0;
415  m_ulReserved = 0;
416  }
417  }
418 
419  /// Returns the numbers of items in the array.
421  {
422  return m_uLength;
423  }
424 
425  /// Returns a pointer to the first item in the array.
426  AkForceInline T * Data() const
427  {
428  return m_pItems;
429  }
430 
431  /// Returns true if the number items in the array is 0, false otherwise.
432  AkForceInline bool IsEmpty() const
433  {
434  return m_uLength == 0;
435  }
436 
437  /// Returns a pointer to the specified item in the list if it exists, 0 if not found.
438  AkForceInline T* Exists(ARG_T in_Item) const
439  {
440  Iterator it = FindEx( in_Item );
441  return ( it != End() ) ? it.pItem : 0;
442  }
443 
444  /// Add an item in the array, without filling it.
445  /// Returns a pointer to the location to be filled.
447  {
448  size_t cItems = Length();
449 
450 #if defined(_MSC_VER)
451 #pragma warning( push )
452 #pragma warning( disable : 4127 )
453 #endif
454  if ( ( cItems >= m_ulReserved ) && TGrowBy > 0 )
455  {
456  if ( !GrowArray() )
457  return 0;
458  }
459 #if defined(_MSC_VER)
460 #pragma warning( pop )
461 #endif
462 
463  // have we got space for a new one ?
464  if( cItems < m_ulReserved )
465  {
466  T * pEnd = m_pItems + m_uLength++;
467  AkPlacementNew( pEnd ) T;
468  return pEnd;
469  }
470 
471  return 0;
472  }
473 
474  /// Add an item in the array, and fills it with the provided item.
475  AkForceInline T * AddLast(ARG_T in_rItem)
476  {
477  T * pItem = AddLast();
478  if ( pItem )
479  *pItem = in_rItem;
480  return pItem;
481  }
482 
483  /// Returns a reference to the last item in the array.
484  T& Last()
485  {
486  AKASSERT( m_uLength );
487 
488  return *( m_pItems + m_uLength - 1 );
489  }
490 
491  /// Removes the last item from the array.
492  void RemoveLast()
493  {
494  AKASSERT( m_uLength );
495  ( m_pItems + m_uLength - 1 )->~T();
496  m_uLength--;
497  }
498 
499  /// Removes the specified item if found in the array.
500  AKRESULT Remove(ARG_T in_rItem)
501  {
502  Iterator it = FindEx( in_rItem );
503  if ( it != End() )
504  {
505  Erase( it );
506  return AK_Success;
507  }
508 
509  return AK_Fail;
510  }
511 
512  /// Fast remove of the specified item in the array.
513  /// This method do not guarantee keeping ordering of the array.
514  AKRESULT RemoveSwap(ARG_T in_rItem)
515  {
516  Iterator it = FindEx( in_rItem );
517  if ( it != End() )
518  {
519  EraseSwap( it );
520  return AK_Success;
521  }
522 
523  return AK_Fail;
524  }
525 
526  /// Removes all items in the array
527  void RemoveAll()
528  {
529  for ( Iterator it = Begin(), itEnd = End(); it != itEnd; ++it )
530  (*it).~T();
531  m_uLength = 0;
532  }
533 
534  /// Operator [], return a reference to the specified index.
535  AkForceInline T& operator[](unsigned int uiIndex) const
536  {
537  AKASSERT( m_pItems );
538  AKASSERT( uiIndex < Length() );
539  return m_pItems[uiIndex];
540  }
541 
542  /// Insert an item at the specified position without filling it.
543  /// Returns the pointer to the item to be filled.
544  T * Insert(unsigned int in_uIndex)
545  {
546  AKASSERT( in_uIndex <= Length() );
547 
548  size_t cItems = Length();
549 
550 #if defined(_MSC_VER)
551 #pragma warning( push )
552 #pragma warning( disable : 4127 )
553 #endif
554  if ( ( cItems >= m_ulReserved ) && TGrowBy > 0 )
555  {
556  if ( !GrowArray() )
557  return 0;
558  }
559 #if defined(_MSC_VER)
560 #pragma warning( pop )
561 #endif
562 
563  // have we got space for a new one ?
564  if( cItems < m_ulReserved )
565  {
566  T * pItemLast = m_pItems + m_uLength++;
567  AkPlacementNew( pItemLast ) T;
568 
569  // Move items by 1
570 
571  for ( T * pItem = pItemLast; pItem > ( m_pItems + in_uIndex ); --pItem )
572  TMovePolicy::Move( pItem[ 0 ], pItem[ -1 ] );
573 
574  // Reinitialize item at index
575 
576  ( m_pItems + in_uIndex )->~T();
577  AkPlacementNew( m_pItems + in_uIndex ) T;
578 
579  return m_pItems + in_uIndex;
580  }
581 
582  return 0;
583  }
584 
585  /// Resize the array.
586  bool GrowArray( AkUInt32 in_uGrowBy = TGrowBy )
587  {
588  AKASSERT( in_uGrowBy );
589 
590  AkUInt32 ulNewReserve = m_ulReserved + in_uGrowBy;
591  T * pNewItems = NULL;
592  size_t cItems = Length();
593  if (TMovePolicy::IsTrivial())
594  {
595  pNewItems = (T *)TAlloc::ReAlloc(m_pItems, sizeof(T) * cItems, sizeof(T) * ulNewReserve);
596  if (!pNewItems)
597  return false;
598  }
599  else
600  {
601  pNewItems = (T *)TAlloc::Alloc(sizeof(T) * ulNewReserve);
602  if (!pNewItems)
603  return false;
604 
605  // Copy all elements in new array, destroy old ones
606  if (m_pItems && m_pItems != pNewItems /*AkHybridAllocator may serve up same memory*/)
607  {
608  for (size_t i = 0; i < cItems; ++i)
609  {
610  AkPlacementNew(pNewItems + i) T;
611 
612  TMovePolicy::Move(pNewItems[i], m_pItems[i]);
613 
614  m_pItems[i].~T();
615  }
616 
618  }
619  }
620 
621  m_pItems = pNewItems;
622  m_ulReserved = ulNewReserve;
623  return true;
624  }
625 
626  /// Resize the array to the specified size.
627  bool Resize(AkUInt32 in_uiSize)
628  {
629  AkUInt32 cItems = Length();
630  if (in_uiSize < cItems)
631  {
632  //Destroy superfluous elements
633  for(AkUInt32 i = in_uiSize - 1 ; i < cItems; i++)
634  {
635  m_pItems[ i ].~T();
636  }
637  m_uLength = in_uiSize;
638  return true;
639  }
640 
641  if ( in_uiSize > m_ulReserved )
642  {
643  if ( !GrowArray(in_uiSize - cItems) )
644  return false;
645  }
646 
647  //Create the missing items.
648  for(size_t i = cItems; i < in_uiSize; i++)
649  {
650  AkPlacementNew( m_pItems + i ) T;
651  }
652 
653  m_uLength = in_uiSize;
654  return true;
655  }
656 
658  {
659  Term();
660 
661  TAlloc::TransferMem( (void*&)m_pItems, in_rSource, (void*)in_rSource.m_pItems );
662  m_uLength = in_rSource.m_uLength;
663  m_ulReserved = in_rSource.m_ulReserved;
664 
665  in_rSource.m_pItems = NULL;
666  in_rSource.m_uLength = 0;
667  in_rSource.m_ulReserved = 0;
668  }
669 
671  {
672  Term();
673 
674  if (Resize(in_rSource.Length()))
675  {
676  for (AkUInt32 i = 0; i < in_rSource.Length(); ++i)
677  m_pItems[i] = in_rSource.m_pItems[i];
678  return AK_Success;
679  }
680  return AK_Fail;
681  }
682 
683 protected:
684 
685  T * m_pItems; ///< pointer to the beginning of the array.
686  AkUInt32 m_uLength; ///< number of items in the array.
687  AkUInt32 m_ulReserved; ///< how many we can have at most (currently allocated).
688 };
689 
690 
691 #endif
AkForceInline void * Alloc(size_t in_uSize)
Definition: AkArray.h:74
Iterator EraseSwap(Iterator &in_rIter)
Definition: AkArray.h:368
AK_ALIGN(char m_buffer[uBufferSizeBytes], uAlignmentSize)
Iterator FindEx(ARG_T in_Item) const
Returns the iterator th the specified item, will be End() if the item is not found.
Definition: AkArray.h:286
AKRESULT __cdecl Free(AkMemPoolId in_poolId, void *in_pMemAddress)
bool operator==(const Iterator &in_rOp) const
== operator</div>
Definition: AkArray.h:256
Iterator.
Definition: AkArray.h:212
The operation was successful.
Definition: AkTypes.h:129
AKRESULT Copy(const AkArray< T, ARG_T, TAlloc, TGrowBy, TMovePolicy > &in_rSource)
Definition: AkArray.h:670
AkForceInline void TransferMem(void *&io_pDest, AkArrayAllocatorNoAlign< U_POOL > in_srcAlloc, void *in_pSrc)
Definition: AkArray.h:65
static const AkUInt32 _uBufferSizeBytes
Definition: AkArray.h:109
AkArrayAllocatorNoAlign< _ArrayPoolDefault > ArrayPoolDefault
Definition: AkArray.h:184
AkForceInline void * ReAlloc(void *in_pCurrent, size_t in_uOldSize, size_t in_uNewSize)
Definition: AkArray.h:55
AkForceInline AkUInt32 Length() const
Returns the numbers of items in the array.
Definition: AkArray.h:420
AKRESULT
Standard function call result.
Definition: AkTypes.h:126
void Erase(unsigned int in_uIndex)
Erase the item at the specified index.
Definition: AkArray.h:348
AKRESULT Remove(ARG_T in_rItem)
Removes the specified item if found in the array.
Definition: AkArray.h:500
Iterator & operator--()
– operator</div>
Definition: AkArray.h:241
#define AK_DEFINE_ARRAY_POOL(_name_, _poolID_)
Definition: AkArray.h:35
AkForceInline void AkMemCpy(void *pDest, const void *pSrc, AkUInt32 uSize)
Platform Independent Helper.
Definition: AkPlatformFuncs.h:330
AkArrayAllocatorNoAlign< _ArrayPoolLEngineDefault > ArrayPoolLEngineDefault
Definition: AkArray.h:185
Specific implementation of array.
Definition: AkArray.h:189
The operation failed.
Definition: AkTypes.h:130
#define AK_SIMD_ALIGNMENT
Platform-specific alignment requirement for SIMD data.
Definition: AkTypes.h:65
#define AKASSERT(Condition)
Definition: AkAssert.h:69
AkForceInline void Free(void *in_pAddress)
Definition: AkArray.h:130
AkForceInline void TransferMem(void *&io_pDest, AkArrayAllocatorAlignedSimd< U_POOL > in_srcAlloc, void *in_pSrc)
Definition: AkArray.h:95
T & operator *()
Definition: AkArray.h:249
~AkArray()
Destructor.
Definition: AkArray.h:201
AkArray()
Constructor.
Definition: AkArray.h:193
T * m_pItems
pointer to the beginning of the array.
Definition: AkArray.h:685
bool GrowArray(AkUInt32 in_uGrowBy=TGrowBy)
Resize the array.
Definition: AkArray.h:586
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.
Definition: AkArray.h:438
#define AkForceInline
Force inlining.
Definition: AkTypes.h:62
static AkForceInline bool IsTrivial()
Definition: AkArray.h:177
T * pItem
Pointer to the item in the array.
Definition: AkArray.h:214
Iterator End() const
Returns the iterator to the end of the array.
Definition: AkArray.h:278
AKRESULT Reserve(AkUInt32 in_ulReserve)
Pre-Allocate a number of spaces in the array.
Definition: AkArray.h:388
AKRESULT __cdecl Falign(AkMemPoolId in_poolId, void *in_pMemAddress)
AkUInt32 m_uLength
number of items in the array.
Definition: AkArray.h:686
AKRESULT RemoveSwap(ARG_T in_rItem)
Definition: AkArray.h:514
AkUInt32 m_ulReserved
how many we can have at most (currently allocated).
Definition: AkArray.h:687
AkForceInline bool IsEmpty() const
Returns true if the number items in the array is 0, false otherwise.
Definition: AkArray.h:432
Iterator Begin() const
Returns the iterator to the first item of the array, will be End() if the array is empty.
Definition: AkArray.h:270
void Transfer(AkArray< T, ARG_T, TAlloc, TGrowBy, TMovePolicy > &in_rSource)
Definition: AkArray.h:657
void *__cdecl Malign(AkMemPoolId in_poolId, size_t in_uSize, AkUInt32 in_uAlignment)
Iterator operator+(AkUInt32 inc) const
Definition: AkArray.h:217
void *__cdecl Malloc(AkMemPoolId in_poolId, size_t in_uSize)
static AkForceInline void Move(T &in_Dest, T &in_Src)
Definition: AkArray.h:157
#define NULL
Definition: AkTypes.h:49
AkForceInline void * ReAlloc(void *in_pCurrent, size_t in_uOldSize, size_t in_uNewSize)
Definition: AkArray.h:79
AkForceInline void * Alloc(size_t in_uSize)
Definition: AkArray.h:111
Iterator BinarySearch(ARG_T in_Item) const
Definition: AkArray.h:301
#define AkPlacementNew(_memory)
Definition: AkObject.h:53
T & Last()
Returns a reference to the last item in the array.
Definition: AkArray.h:484
AkMemPoolId g_LEngineDefaultPoolId
Iterator Erase(Iterator &in_rIter)
Erase the specified iterator from the array.
Definition: AkArray.h:327
Iterator & operator++()
++ operator</div>
Definition: AkArray.h:233
static AkForceInline void Move(T &in_Dest, T &in_Src)
Definition: AkArray.h:172
AkUInt32 operator-(Iterator const &rhs) const
Definition: AkArray.h:226
AkForceInline T * AddLast()
Definition: AkArray.h:446
AkForceInline T * AddLast(ARG_T in_rItem)
Add an item in the array, and fills it with the provided item.
Definition: AkArray.h:475
AkArrayAllocatorAlignedSimd< _ArrayPoolLEngineDefault > ArrayPoolLEngineDefaultAlignedSimd
Definition: AkArray.h:186
Memory error.
Definition: AkTypes.h:157
uint32_t AkUInt32
Unsigned 32-bit integer.
Definition: AkTypes.h:78
AkForceInline void * ReAlloc(void *in_pCurrent, size_t in_uOldSize, size_t in_uNewSize)
Definition: AkArray.h:119
bool operator !=(const Iterator &in_rOp) const
!= operator</div>
Definition: AkArray.h:262
AkUInt32 Reserved() const
Definition: AkArray.h:405
AkForceInline T & operator[](unsigned int uiIndex) const
Operator [], return a reference to the specified index.
Definition: AkArray.h:535
AkMemPoolId g_DefaultPoolId
AkForceInline void * Alloc(size_t in_uSize)
Definition: AkArray.h:50
void RemoveAll()
Removes all items in the array.
Definition: AkArray.h:527
T * Insert(unsigned int in_uIndex)
Definition: AkArray.h:544
AkForceInline void Free(void *in_pAddress)
Definition: AkArray.h:60
void *__cdecl Realloc(AkMemPoolId in_poolId, void *in_pAlloc, size_t in_uSize)
bool Resize(AkUInt32 in_uiSize)
Resize the array to the specified size.
Definition: AkArray.h:627
void RemoveLast()
Removes the last item from the array.
Definition: AkArray.h:492
AkForceInline void TransferMem(void *&io_pDest, AkHybridAllocator< uBufferSizeBytes, uAlignmentSize > &in_srcAlloc, void *in_pSrc)
Definition: AkArray.h:136
AkForceInline T * Data() const
Returns a pointer to the first item in the array.
Definition: AkArray.h:426
AkForceInline void Free(void *in_pAddress)
Definition: AkArray.h:90
static AkForceInline bool IsTrivial()
Definition: AkArray.h:162
void Term()
Term the array. Must be called before destroying the object.
Definition: AkArray.h:408