docs.unity.cn
    Show / Hide Table of Contents

    Struct AllocatorManager.AllocatorHandle

    Represents the allocator function used within an allocator.

    Namespace: Unity.Collections
    Syntax
    public struct AllocatorHandle : AllocatorManager.IAllocator, IDisposable

    Fields

    Index

    This allocator's index into the global table of allocator functions.

    Declaration
    public ushort Index
    Field Value
    Type Description
    UInt16

    This allocator's index into the global table of allocator functions.

    Version

    This allocator's version number.

    Declaration
    public ushort Version
    Field Value
    Type Description
    UInt16

    This allocator's version number.

    Remarks

    An allocator function is uniquely identified by its combination of Index and Version together: each index has a version number that starts at 0; the version number is incremented each time the index is reused for another registered allocator function.

    Properties

    Function

    For internal use only.

    Declaration
    public AllocatorManager.TryFunction Function { get; }
    Property Value
    Type Description
    AllocatorManager.TryFunction

    For internal use only.

    Implements
    AllocatorManager.IAllocator.Function

    Handle

    This handle.

    Declaration
    public AllocatorManager.AllocatorHandle Handle { get; set; }
    Property Value
    Type Description
    AllocatorManager.AllocatorHandle

    This handle.

    Implements
    AllocatorManager.IAllocator.Handle

    IsCustomAllocator

    Check whether this allocator is a custom allocator.

    Declaration
    public bool IsCustomAllocator { get; }
    Property Value
    Type Description
    Boolean
    Implements
    AllocatorManager.IAllocator.IsCustomAllocator

    ToAllocator

    Cast the Index to Allocator.

    Declaration
    public Allocator ToAllocator { get; }
    Property Value
    Type Description
    Allocator
    Implements
    AllocatorManager.IAllocator.ToAllocator

    Value

    The Index cast to int.

    Declaration
    public int Value { get; }
    Property Value
    Type Description
    Int32

    The Index cast to int.

    Methods

    AllocateBlock<T>(Int32)

    Allocates a block with this allocator function.

    Declaration
    public AllocatorManager.Block AllocateBlock<T>(int items)
        where T : struct
    Parameters
    Type Name Description
    Int32 items

    The number of values to allocate for.

    Returns
    Type Description
    AllocatorManager.Block

    The allocated block.

    Type Parameters
    Name Description
    T

    The type of value to allocate for.

    Dispose()

    Unregister the allocator.

    Declaration
    public void Dispose()

    Try(ref AllocatorManager.Block)

    Tries to allocate the block with this allocator.

    Declaration
    public int Try(ref AllocatorManager.Block block)
    Parameters
    Type Name Description
    AllocatorManager.Block block

    The block to allocate.

    Returns
    Type Description
    Int32

    0 if successful. Otherwise, returns an error code.

    Implements
    AllocatorManager.IAllocator.Try(ref AllocatorManager.Block)

    TryAllocateBlock<T>(out AllocatorManager.Block, Int32)

    Allocates a block from this allocator.

    Declaration
    public int TryAllocateBlock<T>(out AllocatorManager.Block block, int items)
        where T : struct
    Parameters
    Type Name Description
    AllocatorManager.Block block

    Outputs the allocated block.

    Int32 items

    The number of values to allocate for.

    Returns
    Type Description
    Int32

    0 if successful. Otherwise, returns the error code from the allocator function.

    Type Parameters
    Name Description
    T

    The type of value to allocate for.

    Operators

    Implicit(Allocator to AllocatorManager.AllocatorHandle)

    Returns the AllocatorHandle of an allocator.

    Declaration
    public static implicit operator AllocatorManager.AllocatorHandle(Allocator a)
    Parameters
    Type Name Description
    Allocator a

    The Allocator to copy.

    Returns
    Type Description
    AllocatorManager.AllocatorHandle

    The AllocatorHandle of an allocator.

    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on Wednesday, September 29, 2021