Table of Contents

Wwise SDK 2019.2.6
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 of 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  AkUInt32 uNumToSearch = Length();
316  T* pBase = m_pItems;
317  T* pPivot;
318 
319  while ( uNumToSearch > 0 )
320  {
321  pPivot = pBase + ( uNumToSearch >> 1 );
322  if ( in_Item == *pPivot )
323  {
324  Iterator result;
325  result.pItem = pPivot;
326  return result;
327  }
328 
329  if ( in_Item > *pPivot )
330  {
331  pBase = pPivot + 1;
332  uNumToSearch--;
333  }
334  uNumToSearch >>= 1;
335  }
336 
337  return End();
338  }
339 
340  /// Erase the specified iterator from the array
341  Iterator Erase( Iterator& in_rIter )
342  {
343  AKASSERT( m_pItems != 0 );
344 
345  // Move items by 1
346 
347  T * pItemLast = m_pItems + m_uLength - 1;
348 
349  for ( T * pItem = in_rIter.pItem; pItem < pItemLast; pItem++ )
350  TMovePolicy::Move( pItem[ 0 ], pItem[ 1 ] );
351 
352  // Destroy the last item
353 
354  pItemLast->~T();
355 
356  m_uLength--;
357 
358  return in_rIter;
359  }
360 
361  /// Erase the item at the specified index
362  void Erase( unsigned int in_uIndex )
363  {
364  AKASSERT( m_pItems != 0 );
365 
366  // Move items by 1
367 
368  T * pItemLast = m_pItems + m_uLength - 1;
369 
370  for ( T * pItem = m_pItems+in_uIndex; pItem < pItemLast; pItem++ )
371  TMovePolicy::Move( pItem[ 0 ], pItem[ 1 ] );
372 
373  // Destroy the last item
374 
375  pItemLast->~T();
376 
377  m_uLength--;
378  }
379 
380  /// Erase the specified iterator in the array. but it dos not guarantee the ordering in the array.
381  /// This version should be used only when the order in the array is not an issue.
382  Iterator EraseSwap( Iterator& in_rIter )
383  {
384  AKASSERT( m_pItems != 0 );
385 
386  if ( Length( ) > 1 )
387  {
388  // Swap last item with this one.
389  TMovePolicy::Move( *in_rIter.pItem, Last( ) );
390  }
391 
392  // Destroy.
393  AKASSERT( Length( ) > 0 );
394  Last( ).~T();
395 
396  m_uLength--;
397 
398  return in_rIter;
399  }
400 
402  {
403  return TGrowBy::GrowBy( 1 ) != 0;
404  }
405 
406  /// Pre-Allocate a number of spaces in the array
407  AKRESULT Reserve( AkUInt32 in_ulReserve )
408  {
409  AKASSERT( m_pItems == 0 && m_uLength == 0 );
410  AKASSERT( in_ulReserve || IsGrowingAllowed() );
411 
412  if ( in_ulReserve )
413  {
414  m_pItems = (T *) TAlloc::Alloc( sizeof( T ) * in_ulReserve );
415  if ( m_pItems == 0 )
416  return AK_InsufficientMemory;
417 
418  m_ulReserved = in_ulReserve;
419  }
420 
421  return AK_Success;
422  }
423 
424  AkUInt32 Reserved() const { return m_ulReserved; }
425 
426  /// Term the array. Must be called before destroying the object.
427  void Term()
428  {
429  if ( m_pItems )
430  {
431  RemoveAll();
432  TAlloc::Free( m_pItems );
433  m_pItems = 0;
434  m_ulReserved = 0;
435  }
436  }
437 
438  /// Returns the numbers of items in the array.
439  AkForceInline AkUInt32 Length() const
440  {
441  return m_uLength;
442  }
443 
444  /// Returns a pointer to the first item in the array.
445  AkForceInline T * Data() const
446  {
447  return m_pItems;
448  }
449 
450  /// Returns true if the number items in the array is 0, false otherwise.
451  AkForceInline bool IsEmpty() const
452  {
453  return m_uLength == 0;
454  }
455 
456  /// Returns a pointer to the specified item in the list if it exists, 0 if not found.
457  AkForceInline T* Exists(ARG_T in_Item) const
458  {
459  Iterator it = FindEx( in_Item );
460  return ( it != End() ) ? it.pItem : 0;
461  }
462 
463  /// Add an item in the array, without filling it.
464  /// Returns a pointer to the location to be filled.
465  AkForceInline T * AddLast()
466  {
467  size_t cItems = Length();
468 
469 #if defined(_MSC_VER)
470 #pragma warning( push )
471 #pragma warning( disable : 4127 )
472 #endif
473  if ( ( cItems >= m_ulReserved ) && IsGrowingAllowed() )
474  {
475  if ( !GrowArray() )
476  return 0;
477  }
478 #if defined(_MSC_VER)
479 #pragma warning( pop )
480 #endif
481 
482  // have we got space for a new one ?
483  if( cItems < m_ulReserved )
484  {
485  T * pEnd = m_pItems + m_uLength++;
486  AkPlacementNew( pEnd ) T;
487  return pEnd;
488  }
489 
490  return 0;
491  }
492 
493  /// Add an item in the array, and fills it with the provided item.
494  AkForceInline T * AddLast(ARG_T in_rItem)
495  {
496  T * pItem = AddLast();
497  if ( pItem )
498  *pItem = in_rItem;
499  return pItem;
500  }
501 
502  /// Returns a reference to the last item in the array.
503  T& Last()
504  {
505  AKASSERT( m_uLength );
506 
507  return *( m_pItems + m_uLength - 1 );
508  }
509 
510  /// Removes the last item from the array.
511  void RemoveLast()
512  {
513  AKASSERT( m_uLength );
514  ( m_pItems + m_uLength - 1 )->~T();
515  m_uLength--;
516  }
517 
518  /// Removes the specified item if found in the array.
519  AKRESULT Remove(ARG_T in_rItem)
520  {
521  Iterator it = FindEx( in_rItem );
522  if ( it != End() )
523  {
524  Erase( it );
525  return AK_Success;
526  }
527 
528  return AK_Fail;
529  }
530 
531  /// Fast remove of the specified item in the array.
532  /// This method do not guarantee keeping ordering of the array.
533  AKRESULT RemoveSwap(ARG_T in_rItem)
534  {
535  Iterator it = FindEx( in_rItem );
536  if ( it != End() )
537  {
538  EraseSwap( it );
539  return AK_Success;
540  }
541 
542  return AK_Fail;
543  }
544 
545  /// Removes all items in the array
546  void RemoveAll()
547  {
548  for ( Iterator it = Begin(), itEnd = End(); it != itEnd; ++it )
549  (*it).~T();
550  m_uLength = 0;
551  }
552 
553  /// Operator [], return a reference to the specified index.
554  AkForceInline T& operator[](unsigned int uiIndex) const
555  {
556  AKASSERT( m_pItems );
557  AKASSERT( uiIndex < Length() );
558  return m_pItems[uiIndex];
559  }
560 
561  /// Insert an item at the specified position without filling it.
562  /// Returns the pointer to the item to be filled.
563  T * Insert(unsigned int in_uIndex)
564  {
565  AKASSERT( in_uIndex <= Length() );
566 
567  size_t cItems = Length();
568 
569 #if defined(_MSC_VER)
570 #pragma warning( push )
571 #pragma warning( disable : 4127 )
572 #endif
573  if ( ( cItems >= m_ulReserved ) && IsGrowingAllowed() )
574  {
575  if ( !GrowArray() )
576  return 0;
577  }
578 #if defined(_MSC_VER)
579 #pragma warning( pop )
580 #endif
581 
582  // have we got space for a new one ?
583  if( cItems < m_ulReserved )
584  {
585  T * pItemLast = m_pItems + m_uLength++;
586  AkPlacementNew( pItemLast ) T;
587 
588  // Move items by 1
589 
590  for ( T * pItem = pItemLast; pItem > ( m_pItems + in_uIndex ); --pItem )
591  TMovePolicy::Move( pItem[ 0 ], pItem[ -1 ] );
592 
593  // Reinitialize item at index
594 
595  ( m_pItems + in_uIndex )->~T();
596  AkPlacementNew( m_pItems + in_uIndex ) T;
597 
598  return m_pItems + in_uIndex;
599  }
600 
601  return 0;
602  }
603 
604  bool GrowArray()
605  {
606  // If no size specified, growing by the declared growth policy of the array.
607  return GrowArray( TGrowBy::GrowBy( m_ulReserved ) );
608  }
609 
610  /// Resize the array.
611  bool GrowArray( AkUInt32 in_uGrowBy )
612  {
613  AKASSERT( in_uGrowBy );
614 
615  AkUInt32 ulNewReserve = m_ulReserved + in_uGrowBy;
616  T * pNewItems = NULL;
617  size_t cItems = Length();
618  if (TMovePolicy::IsTrivial())
619  {
620  pNewItems = (T *)TAlloc::ReAlloc(m_pItems, sizeof(T) * cItems, sizeof(T) * ulNewReserve);
621  if (!pNewItems)
622  return false;
623  }
624  else
625  {
626  pNewItems = (T *)TAlloc::Alloc(sizeof(T) * ulNewReserve);
627  if (!pNewItems)
628  return false;
629 
630  // Copy all elements in new array, destroy old ones
631  if (m_pItems && m_pItems != pNewItems /*AkHybridAllocator may serve up same memory*/)
632  {
633  for (size_t i = 0; i < cItems; ++i)
634  {
635  AkPlacementNew(pNewItems + i) T;
636 
637  TMovePolicy::Move(pNewItems[i], m_pItems[i]);
638 
639  m_pItems[i].~T();
640  }
641 
642  TAlloc::Free(m_pItems);
643  }
644  }
645 
646  m_pItems = pNewItems;
647  m_ulReserved = ulNewReserve;
648  return true;
649  }
650 
651  /// Resize the array to the specified size.
652  bool Resize(AkUInt32 in_uiSize)
653  {
654  AkUInt32 cItems = Length();
655  if (in_uiSize < cItems)
656  {
657  //Destroy superfluous elements
658  for(AkUInt32 i = in_uiSize - 1 ; i < cItems; i++)
659  {
660  m_pItems[ i ].~T();
661  }
662  m_uLength = in_uiSize;
663  return true;
664  }
665 
666  if ( in_uiSize > m_ulReserved )
667  {
668  if ( !GrowArray(in_uiSize - cItems) )
669  return false;
670  }
671 
672  //Create the missing items.
673  for(size_t i = cItems; i < in_uiSize; i++)
674  {
675  AkPlacementNew( m_pItems + i ) T;
676  }
677 
678  m_uLength = in_uiSize;
679  return true;
680  }
681 
683  {
684  Term();
685 
686  TAlloc::TransferMem( (void*&)m_pItems, in_rSource, (void*)in_rSource.m_pItems );
687  m_uLength = in_rSource.m_uLength;
688  m_ulReserved = in_rSource.m_ulReserved;
689 
690  in_rSource.m_pItems = NULL;
691  in_rSource.m_uLength = 0;
692  in_rSource.m_ulReserved = 0;
693  }
694 
696  {
697  Term();
698 
699  if (Resize(in_rSource.Length()))
700  {
701  for (AkUInt32 i = 0; i < in_rSource.Length(); ++i)
702  m_pItems[i] = in_rSource.m_pItems[i];
703  return AK_Success;
704  }
705  return AK_Fail;
706  }
707 
708 protected:
709 
710  T * m_pItems; ///< pointer to the beginning of the array.
711  AkUInt32 m_uLength; ///< number of items in the array.
712  AkUInt32 m_ulReserved; ///< how many we can have at most (currently allocated).
713 };
714 
715 
716 #endif
AkForceInline void TransferMem(void *&io_pDest, AkHybridAllocator< uBufferSizeBytes, uAlignmentSize, T_MEMID > &in_srcAlloc, void *in_pSrc)
Definition: AkArray.h:124
AkUInt32 operator-(Iterator const &rhs) const
Definition: AkArray.h:238
AkForceInline void * Alloc(size_t in_uSize)
Definition: AkArray.h:62
AkForceInline void Free(void *in_pAddress)
Definition: AkArray.h:78
Iterator & operator++()
++ operator</div>
Definition: AkArray.h:245
AkForceInline void * Alloc(size_t in_uSize)
Definition: AkArray.h:63
static const AkUInt32 _uBufferSizeBytes
Definition: AkArray.h:97
~AkArray()
Destructor.
Definition: AkArray.h:213
AkForceInline void * ReAlloc(void *in_pCurrent, size_t in_uOldSize, size_t in_uNewSize)
Definition: AkArray.h:107
AKRESULT Copy(const AkArray< T, ARG_T, TAlloc, TGrowBy, TMovePolicy > &in_rSource)
Definition: AkArray.h:695
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
void RemoveAll()
Removes all items in the array.
Definition: AkArray.h:546
AK_ALIGN(char m_buffer[uBufferSizeBytes], uAlignmentSize)
T & Last()
Returns a reference to the last item in the array.
Definition: AkArray.h:503
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:73
AKRESULT RemoveSwap(ARG_T in_rItem)
Definition: AkArray.h:533
AkForceInline void Free(void *in_pAddress)
Definition: AkArray.h:118
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:457
Specific implementation of array.
Definition: AkArray.h:201
T * pItem
Pointer to the item in the array.
Definition: AkArray.h:226
bool GrowArray(AkUInt32 in_uGrowBy)
Resize the array.
Definition: AkArray.h:611
AkForceInline void TransferMem(void *&io_pDest, AkArrayAllocatorAlignedSimd< T_MEMID > in_srcAlloc, void *in_pSrc)
Definition: AkArray.h:83
bool operator==(const Iterator &in_rOp) const
== operator</div>
Definition: AkArray.h:268
void RemoveLast()
Removes the last item from the array.
Definition: AkArray.h:511
AkUInt32 m_uLength
number of items in the array.
Definition: AkArray.h:711
bool Resize(AkUInt32 in_uiSize)
Resize the array to the specified size.
Definition: AkArray.h:652
AkArray()
Constructor.
Definition: AkArray.h:205
AkForceInline T * AddLast(ARG_T in_rItem)
Add an item in the array, and fills it with the provided item.
Definition: AkArray.h:494
Iterator.
Definition: AkArray.h:224
AkForceInline void AkMemCpy(void *pDest, const void *pSrc, AkUInt32 uSize)
Platform Independent Helper.
Definition: AkPlatformFuncs.h:333
static AkUInt32 GrowBy(AkUInt32)
Definition: AkArray.h:183
Iterator End() const
Returns the iterator to the end of the array.
Definition: AkArray.h:290
AkUInt32 Reserved() const
Definition: AkArray.h:424
AkForceInline void * Alloc(size_t in_uSize)
Definition: AkArray.h:99
T & operator*()
Definition: AkArray.h:261
void Transfer(AkArray< T, ARG_T, TAlloc, TGrowBy, TMovePolicy > &in_rSource)
Definition: AkArray.h:682
Iterator Erase(Iterator &in_rIter)
Erase the specified iterator from the array.
Definition: AkArray.h:341
static AkForceInline void Move(T &in_Dest, T &in_Src)
Definition: AkArray.h:160
AkUInt32 m_ulReserved
how many we can have at most (currently allocated).
Definition: AkArray.h:712
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
AkForceInline AkUInt32 Length() const
Returns the numbers of items in the array.
Definition: AkArray.h:439
static AkForceInline bool IsTrivial()
Definition: AkArray.h:165
AKRESULT Remove(ARG_T in_rItem)
Removes the specified item if found in the array.
Definition: AkArray.h:519
void Erase(unsigned int in_uIndex)
Erase the item at the specified index.
Definition: AkArray.h:362
bool operator!=(const Iterator &in_rOp) const
!= operator</div>
Definition: AkArray.h:274
bool GrowArray()
Definition: AkArray.h:604
AkForceInline T * AddLast()
Definition: AkArray.h:465
void Term()
Term the array. Must be called before destroying the object.
Definition: AkArray.h:427
AkForceInline void * ReAlloc(void *in_pCurrent, size_t in_uOldSize, size_t in_uNewSize)
Definition: AkArray.h:68
static AkForceInline bool IsTrivial()
Definition: AkArray.h:150
static AkUInt32 GrowBy(AkUInt32 in_CurrentArraySize)
Definition: AkArray.h:188
static AkUInt32 GrowBy(AkUInt32)
Definition: AkArray.h:178
AkForceInline bool IsEmpty() const
Returns true if the number items in the array is 0, false otherwise.
Definition: AkArray.h:451
static AkForceInline void Move(T &in_Dest, T &in_Src)
Definition: AkArray.h:145
AkForceInline T * Data() const
Returns a pointer to the first item in the array.
Definition: AkArray.h:445
T * Insert(unsigned int in_uIndex)
Definition: AkArray.h:563
Iterator & operator--()
– operator</div>
Definition: AkArray.h:253
bool IsGrowingAllowed()
Definition: AkArray.h:401
AkForceInline void TransferMem(void *&io_pDest, AkArrayAllocatorNoAlign< T_MEMID > in_srcAlloc, void *in_pSrc)
Definition: AkArray.h:78
Iterator EraseSwap(Iterator &in_rIter)
Definition: AkArray.h:382
AkForceInline T & operator[](unsigned int uiIndex) const
Operator [], return a reference to the specified index.
Definition: AkArray.h:554
AKRESULT Reserve(AkUInt32 in_ulReserve)
Pre-Allocate a number of spaces in the array.
Definition: AkArray.h:407
Iterator operator+(AkUInt32 inc) const
Definition: AkArray.h:229
Iterator BinarySearch(ARG_T in_Item) const
Definition: AkArray.h:313
T * m_pItems
pointer to the beginning of the array.
Definition: AkArray.h:710