Skip to content

LinearIncrementingEntityIdGenerator

ctreffs edited this page Oct 7, 2020 · 2 revisions

LinearIncrementingEntityIdGenerator

Linear incrementing entity id generator

public struct LinearIncrementingEntityIdGenerator: EntityIdentifierGenerator

This entity id generator creates linearly incrementing entity ids unless an entity is marked as unused then the marked id is returned next in a FIFO order.

Furthermore it respects order of entity ids on initialization, meaning the provided ids on initialization will be provided in order until all are in use. After that the free entities start at the lowest available id increasing linearly skipping already in-use entity ids.

Inheritance

EntityIdentifierGenerator

Initializers

init(startProviding:)

@inlinable public init<EntityIds>(startProviding initialEntityIds: EntityIds) where EntityIds: BidirectionalCollection, EntityIds.Element == EntityIdentifier

init()

@inlinable public init()

Methods

nextId()

@inline(__always) public func nextId() -> EntityIdentifier

markUnused(entityId:)

@inline(__always) public func markUnused(entityId: EntityIdentifier)
Clone this wiki locally