Version

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

Cette page a-t-elle été utile ?

Besoin d'aide ?

Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !

Visitez notre page d'Aide

Décrivez-nous de votre projet. Nous sommes là pour vous aider.

Enregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !

Partir du bon pied avec Wwise