allocators

class Block(start_offset: int = 0, stop_offset: int = 0)

Bases: object

__ge__(other)

Return self>=value.

__gt__(other)

Return self>value.

__le__(other)

Return self<=value.

__lt__(other)

Return self<value.

property size : float
class BlockAllocator(heap_maximum: int = 1024, heap_minimum: int = 0)

Bases: object

A block allocator.

>>> from supriya.contexts.allocators import BlockAllocator
>>> allocator = BlockAllocator(heap_maximum=16)
>>> allocator.allocate(4)
0
>>> allocator.allocate(4)
4
>>> allocator.allocate(4)
8
>>> allocator.allocate(8) is None
True
>>> allocator.free(8)
>>> allocator.allocate(8)
8
allocate(size: int = 1) int | None
free(index: int) None
class NodeIdAllocator(client_id: int = 0, initial_node_id: int = 1000, locked=True)

Bases: object

A node ID allocator.

>>> from supriya.contexts.allocators import NodeIdAllocator
>>> allocator = NodeIdAllocator()
>>> for _ in range(3):
...     allocator.allocate_node_id()
... 
1000
1001
1002
>>> for _ in range(3):
...     allocator.allocate_permanent_node_id()
... 
1
2
3
>>> allocator.free_permanent_node_id(2)
>>> allocator.allocate_permanent_node_id()
2
allocate(count: int = 1) int
allocate_node_id(count: int = 1) int
allocate_permanent_node_id() int
free(node_id: int) None
free_permanent_node_id(node_id: int) None