docs.unity3d.com
    目次を表示する/隠す

    Class NativeParallelHashMapExtensions

    Provides extension methods for hash maps.

    Inheritance
    Object
    NativeParallelHashMapExtensions
    Namespace: Unity.Collections
    Syntax
    public static class NativeParallelHashMapExtensions

    Methods

    GetUniqueKeyArray<TKey, TValue>(UnsafeMultiHashMap<TKey, TValue>, AllocatorManager.AllocatorHandle)

    Returns an array populated with the unique keys from this multi hash map.

    Declaration
    public static (NativeArray<TKey>, int) GetUniqueKeyArray<TKey, TValue>(this UnsafeMultiHashMap<TKey, TValue> container, AllocatorManager.AllocatorHandle allocator)
        where TKey : struct, IEquatable<TKey>, IComparable<TKey> where TValue : struct
    Parameters
    Type Name Description
    UnsafeMultiHashMap<TKey, TValue> container

    The multi hash map.

    AllocatorManager.AllocatorHandle allocator

    The allocator to use.

    Returns
    Type Description
    (T1, T2)<NativeArray<TKey>, Int32>

    An array populated with the unique keys from this multi hash map.

    Type Parameters
    Name Description
    TKey

    The type of the keys.

    TValue

    The type of the values.

    GetUniqueKeyArray<TKey, TValue>(NativeMultiHashMap<TKey, TValue>, AllocatorManager.AllocatorHandle)

    Returns an array populated with the unique keys from this multi hash map.

    Declaration
    public static (NativeArray<TKey>, int) GetUniqueKeyArray<TKey, TValue>(this NativeMultiHashMap<TKey, TValue> container, AllocatorManager.AllocatorHandle allocator)
        where TKey : struct, IEquatable<TKey>, IComparable<TKey> where TValue : struct
    Parameters
    Type Name Description
    NativeMultiHashMap<TKey, TValue> container

    The multi hash map.

    AllocatorManager.AllocatorHandle allocator

    The allocator to use.

    Returns
    Type Description
    (T1, T2)<NativeArray<TKey>, Int32>

    An array populated with the unique keys from this multi hash map.

    Type Parameters
    Name Description
    TKey

    The type of the keys.

    TValue

    The type of the values.

    GetUnsafeBucketData<TKey, TValue>(NativeMultiHashMap<TKey, TValue>)

    Returns a "bucket" view of this multi hash map.

    Declaration
    public static UnsafeParallelHashMapBucketData GetUnsafeBucketData<TKey, TValue>(this NativeMultiHashMap<TKey, TValue> container)
        where TKey : struct, IEquatable<TKey> where TValue : struct
    Parameters
    Type Name Description
    NativeMultiHashMap<TKey, TValue> container

    The multi hash map.

    Returns
    Type Description
    UnsafeParallelHashMapBucketData

    A "bucket" view of this multi hash map.

    Type Parameters
    Name Description
    TKey

    The type of the keys.

    TValue

    The type of the values.

    Remarks

    Internally, the elements of a hash map are split into buckets of type UnsafeParallelHashMapBucketData.

    With buckets, a job can safely access the elements of a hash map concurrently as long as each individual bucket is accessed only from an individual thread. Effectively, it is not safe to read elements of an individual bucket concurrently, but it is safe to read elements of separate buckets concurrently.

    GetUnsafeBucketData<TKey, TValue>(NativeParallelHashMap<TKey, TValue>)

    Returns a "bucket" view of this hash map.

    Declaration
    public static UnsafeParallelHashMapBucketData GetUnsafeBucketData<TKey, TValue>(this NativeParallelHashMap<TKey, TValue> container)
        where TKey : struct, IEquatable<TKey> where TValue : struct
    Parameters
    Type Name Description
    NativeParallelHashMap<TKey, TValue> container

    The hash map.

    Returns
    Type Description
    UnsafeParallelHashMapBucketData

    A "bucket" view of this hash map.

    Type Parameters
    Name Description
    TKey

    The type of the keys.

    TValue

    The type of the values.

    Remarks

    Internally, the elements of a hash map are split into buckets of type UnsafeParallelHashMapBucketData.

    With buckets, a job can safely access the elements of a hash map concurrently as long as each individual bucket is accessed only from an individual thread. Effectively, it is not safe to read elements of an individual bucket concurrently, but it is safe to read elements of separate buckets concurrently.

    Remove<TKey, TValue>(NativeMultiHashMap<TKey, TValue>, TKey, TValue)

    Removes all occurrences of a particular key-value pair.

    Declaration
    public static void Remove<TKey, TValue>(this NativeMultiHashMap<TKey, TValue> container, TKey key, TValue value)
        where TKey : struct, IEquatable<TKey> where TValue : struct, IEquatable<TValue>
    Parameters
    Type Name Description
    NativeMultiHashMap<TKey, TValue> container

    The multi hash map.

    TKey key

    The key of the key-value pairs to remove.

    TValue value

    The value of the key-value pairs to remove.

    Type Parameters
    Name Description
    TKey

    The type of the keys.

    TValue

    The type of the values.

    Remarks

    Removes all key-value pairs which have a particular key and which also have a particular value. In other words: (key AND value) rather than (key OR value).

    Unique<T>(NativeArray<T>)

    Removes duplicate values from this sorted array and returns the number of values remaining.

    Declaration
    public static int Unique<T>(this NativeArray<T> array)
        where T : struct, IEquatable<T>
    Parameters
    Type Name Description
    NativeArray<T> array

    The array from which to remove duplicates.

    Returns
    Type Description
    Int32

    The number of unique elements in this array.

    Type Parameters
    Name Description
    T

    The type of values in the array.

    Remarks

    Uses Equals to determine whether values are duplicates.

    Expects the array to already be sorted.

    The remaining elements will be tightly packed at the front of the array.

    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)