Table of Contents

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