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/list/IList.lvt

namespace Livt.Collections.List

/**
 * Contract for a typed list with fixed storage and a variable logical size.
 *
 * Implementations ignore additions while full and reject indices outside the
 * logical size. Invalid and empty reads return the element type's zero value.
 */
interface IList<T>
{
	/**
	 * Appends a value when capacity is available.
	 */
	fn Add(value: T)

	/**
	 * Returns the value at index, or zero when index is invalid.
	 */
	fn Get(index: int) T

	/**
	 * Replaces an existing value; invalid indices are ignored.
	 */
	fn Set(index: int, value: T)

	/**
	 * Removes and returns the final value, or zero when empty.
	 */
	fn RemoveLast() T

	/**
	 * Returns the current logical number of values.
	 */
	fn GetSize() int

	/**
	 * Returns true when the list contains no values.
	 */
	fn IsEmpty() bool

	/**
	 * Returns true when the list has reached its fixed capacity.
	 */
	fn IsFull() bool

	/**
	 * Resets the logical list state without erasing storage.
	 */
	fn Clear()
}