Class StackManager<TFrame>
A base service class for managing a stack of frames.
public abstract class StackManager<TFrame> where TFrame : IStackFrame, IEquatable<TFrame>
Type Parameters
TFrameThe type of IStackFrame managed frames being stacked.
- Inheritance
-
StackManager<TFrame>
- Derived
- Inherited Members
Properties
Depth
Gets the current managed stack depth.
public int Depth { get; }
Property Value
Methods
Clear()
Clears the managed stack.
public void Clear()
OnBeforeTryPop()
🧩 override this method in a derived class to intercept and abort a frame pop.
protected virtual bool OnBeforeTryPop()
Returns
- bool
trueif the pop can proceed,falseif it's aborted.
OnBeforeTryPush(TFrame)
🧩 override this method in a derived class to intercept and abort a frame push.
protected virtual bool OnBeforeTryPush(TFrame frame)
Parameters
frameTFrameThe stack frame to be pushed.
Returns
- bool
trueif the push can proceed,falseif it's aborted.
OnFramePopped(TFrame?)
🧩 override this method in a derived class to inject behavior whenever a frame is successfully popped from the managed stack.
protected virtual void OnFramePopped(TFrame? frame)
Parameters
frameTFrameThe stack frame that was popped.
OnPushed(TFrame)
🧩 override this method in a derived class to inject behavior whenever a frame has been pushed onto the managed stack.
protected virtual void OnPushed(TFrame frame)
Parameters
frameTFrameThe stack frame that was pushed.
OnStackCleared()
🧩 override this method to clean up any instance state in a derived class when the managed stack is cleared..
protected virtual void OnStackCleared()
TryPop(out TFrame?)
Pops the top-most frame from the managed stack.
public bool TryPop(out TFrame? frame)
Parameters
frameTFrameThe retrieved stack frame, if successful.
Returns
- bool
trueif the frame was successfully popped,falseotherwise.
TryPush(TFrame)
Pushes the specified frame to the managed stack.
public bool TryPush(TFrame frame)
Parameters
frameTFrameThe stack frame to be pushed.
Returns
- bool
trueif the frame was successfully pushed,falseotherwise.