public NativeMultiHashMap <T1, T2> AllocateAndAutoDisposeNativeMultiHashMap <T1, T2>(int capacity, Allocator allocator) where T1 : struct, IEquatable <T1> where T2 : struct { var native = new NativeMultiHashMap <T1, T2>(capacity, allocator); EnqueueNative(new NativeMultiHashMapWrapper <T1, T2>(native), allocator); return(native); }
public static unsafe JobHandle Schedule <TJob, TKey>(this TJob jobData, NativeMultiHashMap <TKey, int> hashMap, int minIndicesPerJobCount, JobHandle dependsOn = new JobHandle()) where TJob : struct, IJobNativeMultiHashMapMergedSharedKeyIndices where TKey : struct, IEquatable <TKey> { var fullData = new NativeMultiHashMapUniqueHashJobStruct <TJob, TKey> .JobMultiHashMap { HashMap = hashMap, JobData = jobData }; var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref fullData), NativeMultiHashMapUniqueHashJobStruct <TJob, TKey> .Initialize(), dependsOn, ScheduleMode.Batched); return(JobsUtility.ScheduleParallelFor(ref scheduleParams, hashMap.m_Buffer->bucketCapacityMask + 1, minIndicesPerJobCount)); }
public static bool AddValueIfUnique <TKey, TValue>(this NativeMultiHashMap <TKey, TValue> hashMap, TKey key, TValue value) where TKey : struct, IEquatable <TKey> where TValue : struct, IEquatable <TValue> { if (hashMap.TryGetFirstValue(key, out var existingValue, out var iterator)) { do { if (value.Equals(existingValue)) { return(false); } } while (hashMap.TryGetNextValue(out existingValue, ref iterator)); } hashMap.Add(key, value); return(true); }
public NativeMultiHashMapDebuggerTypeProxy(NativeMultiHashMap <TKey, TValue> target) { m_Target = target; }
public void AllocateAndAutoDispose <T1, T2>(ref NativeMultiHashMap <T1, T2> native, int capacity, Allocator allocator) where T1 : struct, IEquatable <T1> where T2 : struct { native = new NativeMultiHashMap <T1, T2>(capacity, allocator); EnqueueNative(new NativeMultiHashMapWrapper <T1, T2>(native), allocator); }
public NativeMultiHashMapWrapper(NativeMultiHashMap <T1, T2> hashMap) { this.hashMap = hashMap; }
public static Tuple <NativeArray <TKey>, int> GetUniqueKeyArray <TKey, TValue>(this NativeMultiHashMap <TKey, TValue> hashMap, Allocator allocator) where TKey : struct, IEquatable <TKey>, IComparable <TKey> where TValue : struct { var withDuplicates = hashMap.GetKeyArray(allocator); withDuplicates.Sort(); int uniques = withDuplicates.Unique(); return(new Tuple <NativeArray <TKey>, int>(withDuplicates, uniques)); }
/// <summary> /// /// </summary> /// <typeparam name="TKey">The type of the keys in the container.</typeparam> /// <typeparam name="TValue">The type of the values in the container.</typeparam> /// <param name="hashMap"></param> /// <param name="allocator"></param> /// <returns></returns> public static (NativeArray <TKey>, int) GetUniqueKeyArray <TKey, TValue>(this NativeMultiHashMap <TKey, TValue> hashMap, Allocator allocator)