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