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/stack/IStack.lvt

namespace Livt.Collections.Stack

/**
 * Contract for a fixed-capacity LIFO stack independent of element type.
 *
 * Implementations ignore writes while full. Empty reads return the element
 * type's zero value.
 */
interface IStack<T>
{
	/**
	 * Appends a value to the top when capacity is available.
	 */
	fn Push(value: T)

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

	/**
	 * Returns the newest value without removing it, or zero when empty.
	 */
	fn Peek() T

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

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

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

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