/// <summary> /// Creates a new list with the specified initial capacity and type of memory allocation. /// </summary> /// <param name="initialCapacity">The initial capacity of the list. If the list grows larger than its capacity, /// the internal array is copied to a new, larger array.</param> /// <param name="allocator">A member of the /// [Unity.Collections.Allocator](https://docs.unity3d.com/ScriptReference/Unity.Collections.Allocator.html) enumeration.</param> /// <param name="options">Memory should be cleared on allocation or left uninitialized.</param> /// <returns>New initialized container.</returns> public static UnsafePtrList *Create(int initialCapacity, Allocator allocator, NativeArrayOptions options = NativeArrayOptions.UninitializedMemory) { UnsafePtrList *listData = AllocatorManager.Allocate <UnsafePtrList>(allocator); *listData = new UnsafePtrList(initialCapacity, allocator, options); return(listData); }
/// <summary> /// /// </summary> /// <param name="ptr"></param> /// <param name="length"></param> /// <returns>New initialized container.</returns> public static UnsafePtrList *Create(void **ptr, int length) { UnsafePtrList *listData = AllocatorManager.Allocate <UnsafePtrList>(AllocatorManager.Persistent); *listData = new UnsafePtrList(ptr, length); return(listData); }
/// <summary> /// Destroys list. /// </summary> /// <param name="listData">Container to destroy.</param> public static void Destroy(UnsafePtrList *listData) { UnsafeList.CheckNull(listData); var allocator = listData->ListData().Allocator.Value == AllocatorManager.Invalid.Value ? AllocatorManager.Persistent : listData->ListData().Allocator ; listData->Dispose(); AllocatorManager.Free(allocator, listData); }
public unsafe ParallelWriter(UnsafePtrList *listData) { Writer = listData->AsParallelWriter(); }