Table of Contents

Class StackManager<TFrame>

Namespace
RDCore.SDK.Runtime.Shared
Assembly
RDCore.SDK.dll

A base service class for managing a stack of frames.

public abstract class StackManager<TFrame> where TFrame : IStackFrame, IEquatable<TFrame>

Type Parameters

TFrame

The 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

int

Frames

Gets the frames currently on the managed stack, top-most first.

public IReadOnlyCollection<TFrame> Frames { get; }

Property Value

IReadOnlyCollection<TFrame>

Methods

Clear()

Clears the managed stack.

public void Clear()

Contains(TFrame)

Whether a frame equal to frame is on the managed stack.

protected bool Contains(TFrame frame)

Parameters

frame TFrame

Returns

bool

OnBeforeTryPop()

🧩 override this method in a derived class to intercept and abort a frame pop.

protected virtual bool OnBeforeTryPop()

Returns

bool

true if the pop can proceed, false if 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

frame TFrame

The stack frame to be pushed.

Returns

bool

true if the push can proceed, false if 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

frame TFrame

The 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

frame TFrame

The 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()

TryPeek(out TFrame)

Gets the top-most frame of the managed stack, if there is one, without enumerating Frames: what the stack is asked for most often, once for every name an activation resolves.

protected bool TryPeek(out TFrame frame)

Parameters

frame TFrame

The top-most frame, when the stack is not empty.

Returns

bool

true if the stack has a frame; false if it is empty.

TryPop(out TFrame?)

Pops the top-most frame from the managed stack.

public bool TryPop(out TFrame? frame)

Parameters

frame TFrame

The retrieved stack frame, if successful.

Returns

bool

true if the frame was successfully popped, false otherwise.

TryPush(TFrame)

Pushes the specified frame to the managed stack.

public bool TryPush(TFrame frame)

Parameters

frame TFrame

The stack frame to be pushed.

Returns

bool

true if the frame was successfully pushed, false otherwise.