src/necsus/util/blockstore

Types

BlockIter = object
BlockStore[V] = ref object
Stores a block of packed values
Entry[V] = ptr EntryData[V]

Procs

proc `[]`[V](store: BlockStore[V]; idx: uint): var V
Reads a field
proc commit[V](entry: Entry[V]) {.inline.}
Marks that an entry is ready to be used
proc del[V](store: var BlockStore[V]; idx: uint): V
Deletes a field
proc index[V](entry: Entry[V]): uint {.inline.}
Returns the index of an entry
proc isDone(iter: BlockIter): bool {.inline, ...raises: [], tags: [], forbids: [].}
proc isFirst(iter: BlockIter): bool {....raises: [], tags: [], forbids: [].}
func len[V](blockstore: var BlockStore[V]): uint
Returns the length of this blockstore
proc newBlockStore[V](size: SomeInteger): BlockStore[V]
Instantiates a new BlockStore
proc next[V](store: var BlockStore[V]; iter: var BlockIter): ptr V {.inline.}
Returns the next value in an iterator
proc reserve[V](blockstore: var BlockStore[V]): Entry[V]
Reserves a slot for a value

Iterators

iterator items[V](store: var BlockStore[V]): var V
Iterate through all values in this BlockStore

Templates

template `[]=`[V](store: BlockStore[V]; idx: uint; newValue: V)
Sets a new value for a key
template push[V](store: var BlockStore[V]; newValue: V): uint
Adds a value and returns an index to it
template set[V](entry: Entry[V]; newValue: V)
Sets a value on an entry
template value[V](entry: Entry[V]): var V
Returns the value of an entry