The allocation table data structure.
More...
The allocation table data structure.
◆ __init__()
def urpc.util.AllocTable.__init__ |
( |
|
self, |
|
|
|
capacity |
|
) |
| |
Initialize the allocation table.
- Parameters
-
capacity | Capacity of the allocation table. |
◆ __delitem__()
def urpc.util.AllocTable.__delitem__ |
( |
|
self, |
|
|
|
index |
|
) |
| |
Remove a value from the table by its index.
- Parameters
-
◆ __getitem__()
def urpc.util.AllocTable.__getitem__ |
( |
|
self, |
|
|
|
index |
|
) |
| |
Get value by index.
- Parameters
-
- Returns
- The value.
◆ __len__()
def urpc.util.AllocTable.__len__ |
( |
|
self | ) |
|
Get number of elements in the table.
- Returns
- Number of elements in the table.
◆ __setitem__()
def urpc.util.AllocTable.__setitem__ |
( |
|
self, |
|
|
|
index, |
|
|
|
value |
|
) |
| |
Set value by index.
- Parameters
-
index | Index of the value. |
value | New value to set. |
◆ add()
def urpc.util.AllocTable.add |
( |
|
self, |
|
|
|
value |
|
) |
| |
Add a value to the table and return its corresponding index.
- Parameters
-
- Returns
- Index of the value.
◆ get()
def urpc.util.AllocTable.get |
( |
|
self, |
|
|
|
index, |
|
|
|
default = None |
|
) |
| |
Get value by index.
(Fallback to default if index corresponds with a spare item)
- Parameters
-
index | Index of the value. |
default | Default value if item is spare. |
- Returns
- The value.
◆ _capacity
urpc.util.AllocTable._capacity |
|
private |
◆ _size
urpc.util.AllocTable._size |
|
private |
◆ _spare_begin
urpc.util.AllocTable._spare_begin |
|
private |
Begin of the spare table items linked list.
◆ _store
urpc.util.AllocTable._store |
|
private |
The documentation for this class was generated from the following file: