C# Class kOS.Safe.Execution.Stack

Inheritance: IStack
显示文件 Open project: KSP-KOS/KOS Class Usage Examples

Public Methods

Method Description
Clear ( ) : void
Dump ( ) : string
GetCallTrace ( ) : List

Return the subroutine call trace of how the code got to where it is right now.

GetLogicalSize ( ) : int

Returns the logical size of the current stack (not its potentially larger storage size).

HasTriggerContexts ( ) : bool

This stack tracks all its pushes and pops to know whether or not it contains subroutine contexts which are from triggers. If there are any still triggers in the stack, this returns true, else false.

MoveStackPointer ( int delta ) : void
Peek ( int digDepth ) : object

Slightly "cheats" and breaks out of the 'stack' model by allowing you to view the contents of somewhere on the stack that is underneath the topmost thing. You can only peek, but not pop values this way.

PeekCheck ( int digDepth, object &item ) : bool

Slightly "cheats" and breaks out of the 'stack' model by allowing you to view the contents of somewhere on the stack that is underneath the topmost thing. You can only peek, but not pop values this way. It returns both the object found there (as an out parameter) and a boolean for whether or not your peek attempt went out of bounds of the stack.

Pop ( ) : object
Push ( object item ) : void

Private Methods

Method Description
ProcessItem ( object item ) : object

Make any conversion needed before pushing an item onto the stack

ThrowIfInvalid ( object item ) : void

Method Details

Clear() public method

public Clear ( ) : void
return void

Dump() public method

public Dump ( ) : string
return string

GetCallTrace() public method

Return the subroutine call trace of how the code got to where it is right now.
public GetCallTrace ( ) : List
return List

GetLogicalSize() public method

Returns the logical size of the current stack (not its potentially larger storage size).
public GetLogicalSize ( ) : int
return int

HasTriggerContexts() public method

This stack tracks all its pushes and pops to know whether or not it contains subroutine contexts which are from triggers. If there are any still triggers in the stack, this returns true, else false.
public HasTriggerContexts ( ) : bool
return bool

MoveStackPointer() public method

public MoveStackPointer ( int delta ) : void
delta int
return void

Peek() public method

Slightly "cheats" and breaks out of the 'stack' model by allowing you to view the contents of somewhere on the stack that is underneath the topmost thing. You can only peek, but not pop values this way.
public Peek ( int digDepth ) : object
digDepth int How far underneath the top to look. Zero means peek at the top, /// 1 means peek at the item just under the top, 2 means peek at the item just under that, and /// so on. Note you CAN peek a negative number, which looks at the secret stack above the /// stack - where the subroutine contexts and local variable contexts are.
return object

PeekCheck() public method

Slightly "cheats" and breaks out of the 'stack' model by allowing you to view the contents of somewhere on the stack that is underneath the topmost thing. You can only peek, but not pop values this way. It returns both the object found there (as an out parameter) and a boolean for whether or not your peek attempt went out of bounds of the stack.
public PeekCheck ( int digDepth, object &item ) : bool
digDepth int How far underneath the top to look. Zero means peek at the top, /// 1 means peek at the item just under the top, 2 means peek at the item just under that, and /// so on. Note you CAN peek a negative number, which looks at the secret stack above the /// stack - where the subroutine contexts and local variable contexts are.
item object The object at that depth. Will be null when digDepth is too large and the stack isn't /// big enough to dig that deep, but it also could return null if the actual value stored there on /// the stack really is a null. If you need to be certain of the difference, use the return value.
return bool

Pop() public method

public Pop ( ) : object
return object

Push() public method

public Push ( object item ) : void
item object
return void