template <typename T, T MaxId, T MinId = 1>

class IdAllocator

Defined at line 27 of file ../../zircon/kernel/lib/id_allocator/include/lib/id_allocator.h

Allocates architecture-specific resource IDs.

IDs of type `T` will be allocated in the range [`MinId`, `MaxId`).

`T` is the type of the ID, and is an integral type.

`MaxId` is the maximum value of an ID.

`MinId` is the minimum value of an ID. This defaults to 1.

Public Methods

void IdAllocator<T, MaxId, MinId> ()

Defined at line 32 of file ../../zircon/kernel/lib/id_allocator/include/lib/id_allocator.h

zx::result<> Reset (T max_id)

Resets the allocator, and sets a new `max_id`, where:

`MinId`

<

`max_id`

<

= `MaxId`.

Defined at line 41 of file ../../zircon/kernel/lib/id_allocator/include/lib/id_allocator.h

zx::result<T> TryAlloc ()

Defined at line 50 of file ../../zircon/kernel/lib/id_allocator/include/lib/id_allocator.h

zx::result<> Free (T id)

Defined at line 59 of file ../../zircon/kernel/lib/id_allocator/include/lib/id_allocator.h