Allocator1D

Description

sealed class Tinman.Engine.Rendering.Util.Allocator1D

Derived from

ICapacity

Helper class for allocating slot ranges in a one-dimensional domain.

Public / Constructors

Allocator1​D


public constructor Allocator1D → (1)

capacity in : int32

[>0]
The capacity, in allocation slots.

Creates a new instance of Allocator1D.

Public / Methods

Allocate


public method Allocate → (1)

count opt : int32 = 1

[>=1]
The number of slots to allocate.

returns → int32

Index of start slot of allocation or -1 iff there are not enough free slots.

Allocates a slot range.

Count


public method Count → (1)

slot in : int32

Index of start slot of allocation.

returns → int32

The number of slots in the allocation or 0 iff slot in is not the start slot of an allocation.

Returns the number of slots in the given allocation.

First


public method First → (1)

slot in : int32

Index of a slot.

returns → int32

Index of the start slot of the allocation that contains slot in or -1 iff there is none.

Returns the index of the start slot of the allocation that contains the given slot.

Release


public method Release → (1)

slot in : int32

[-1..ICapacity.Capacity-1]
Index of start slot of allocation to release or -1.

returns → int32

The number of slots that have been released or 0 iff slot in is not the start slot of an allocation.

Releases an allocated slot range.

If slot in is -1, the method will return silently.