Livt packages

Livt.Collections

Version 1.4.2

Fixed-capacity FIFOs, queues, stacks, circular buffers, lists, and bit sets for Livt hardware.

Published files (62)

src/queue/IQueue.lvt

namespace Livt.Collections

/**
 * Application-level, scheduled FIFO transactions independent of capacity.
 * Failed operations leave contents unchanged; empty reads assign zero.
 * Status queries are snapshots, not reservations.
 */
interface IQueue<T>
{
	/**
	 * Appends a value if space exists when the transaction executes.
	 */
	fn TryEnqueue(value: T) bool

	/**
	 * Removes the oldest value, or assigns zero and returns false.
	 */
	fn TryDequeue(value: out T) bool

	/**
	 * Discards contents without cancelling other pending calls.
	 */
	fn Clear()

	/**
	 * Returns the current number of stored values.
	 */
	fn GetCount() int

	/**
	 * Returns the current number of free slots.
	 */
	fn GetSpace() int
}