Class StateStack<T>
A simple implementation of the IStateStack interface. Defines the Tos property granting read and write access to the current Top of stack.
Inheritance
Implements
Inherited Members
Namespace: Fusee.Xene
Assembly: Fusee.Xene.dll
Syntax
public class StateStack<T> : IStateStack
Type Parameters
Name | Description |
---|---|
T | The type of the entries stored within the stack. |
Constructors
StateStack(Int32)
Initializes a new instance of the StateStack<T> class.
Declaration
public StateStack(int capacity = 8)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | capacity | The initial capacity of the stack. This is the expected maximum stack depth. If the stack depth grows bigger, the stack automatically doubles its capacity internally. |
Properties
Depth
Retrieves the stack's depth.
Declaration
public int Depth { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The current depth of the stack. |
Tos
Gets and sets the Top of stack.
Declaration
public T Tos { get; set; }
Property Value
Type | Description |
---|---|
T | The top of stack. |
Methods
Clear()
Clears the stack. The Depth will be reset to zero.
Declaration
public void Clear()
Pop()
The stack's Pop operation. Decreases the stack Depth about one and restores the previous state.
Declaration
public void Pop()
Push()
The stack's Push operation. Increases the stack Depth about one and copies the top of stack.
Declaration
public void Push()