NodeIdAllocator

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph cluster_builtins { graph [label=builtins]; node [color=1]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } subgraph "cluster_supriya.realtime" { graph [label="supriya.realtime"]; node [color=2]; "supriya.realtime.NodeIdAllocator.NodeIdAllocator" [URL="../api/supriya/realtime/NodeIdAllocator.html#supriya.realtime.NodeIdAllocator.NodeIdAllocator", color=black, fontcolor=white, label="Node\nId\nAllocator", target=_top]; } subgraph "cluster_supriya.system" { graph [label="supriya.system"]; node [color=3]; "supriya.system.SupriyaObject.SupriyaObject" [URL="../api/supriya/realtime/../system/SupriyaObject.html#supriya.system.SupriyaObject.SupriyaObject", label="Supriya\nObject", target=_top]; } "builtins.object" -> "supriya.system.SupriyaObject.SupriyaObject"; "supriya.system.SupriyaObject.SupriyaObject" -> "supriya.realtime.NodeIdAllocator.NodeIdAllocator"; }

class supriya.realtime.NodeIdAllocator.NodeIdAllocator(user_id=0, initial_node_id=1000)[source]

A node ID allocator.

>>> import supriya.realtime
>>> allocator = supriya.realtime.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

Attributes Summary

allocate_node_id
allocate_permanent_node_id
free_permanent_node_id

Special methods

(SupriyaObject).__repr__()

Return repr(self).


Methods

allocate_node_id()[source]
allocate_permanent_node_id()[source]
free_permanent_node_id(node_id)[source]