C# Class kOS.Safe.Function.SafeFunctionBase

Exibir arquivo Open project: KSP-KOS/KOS Class Usage Examples

Public Methods

Method Description
Execute ( SafeSharedObjects shared ) : void

Protected Methods

Method Description
AssertArgBottomAndConsume ( SafeSharedObjects shared ) : void

A utility function that a function's Execute() must use after it has popped all the arguments it was expecting from the stack. It will assert that all the arguments have been consumed exactly, and the next item on the stack is the arg bottom mark. It will consume the arg bottom mark as well.
If the assert fails, an exception is thrown.

CountRemainingArgs ( SafeSharedObjects shared ) : int

A utility function that a function's Execute() may use if it wishes to, to get a count of how many args passed to it that it has not yet consumed still remain on the stack.

DegreesToRadians ( double degrees ) : double
GetDouble ( object argument ) : double
GetFuncName ( ) : string
GetInt ( object argument ) : int
PopStackAssert ( SafeSharedObjects shared ) : object

A utility function that a function's Execute() should use in place of cpu.PopStack(), because it will assert that the value being popped is NOT an ARG_MARKER_STRING, and if it is, it will throw the appropriate error.

PopStructureAssertEncapsulated ( SafeSharedObjects shared, bool barewordOkay = false ) : Structure

Identical to PopValueAssert, but with the additional step of coercing the result into a Structure to be sure, so it won't return primitives.

PopValueAssert ( SafeSharedObjects shared, bool barewordOkay = false ) : object

A utility function that a function's Execute() should use in place of cpu.PopValue(), because it will assert that the value being popped is NOT an ARG_MARKER_STRING, and if it is, it will throw the appropriate error.

RadiansToDegrees ( double radians ) : double
SafeFunctionBase ( ) : System

Method Details

AssertArgBottomAndConsume() protected method

A utility function that a function's Execute() must use after it has popped all the arguments it was expecting from the stack. It will assert that all the arguments have been consumed exactly, and the next item on the stack is the arg bottom mark. It will consume the arg bottom mark as well.
If the assert fails, an exception is thrown.
protected AssertArgBottomAndConsume ( SafeSharedObjects shared ) : void
shared SafeSharedObjects
return void

CountRemainingArgs() protected method

A utility function that a function's Execute() may use if it wishes to, to get a count of how many args passed to it that it has not yet consumed still remain on the stack.
protected CountRemainingArgs ( SafeSharedObjects shared ) : int
shared SafeSharedObjects
return int

DegreesToRadians() protected method

protected DegreesToRadians ( double degrees ) : double
degrees double
return double

Execute() public abstract method

public abstract Execute ( SafeSharedObjects shared ) : void
shared SafeSharedObjects
return void

GetDouble() protected method

protected GetDouble ( object argument ) : double
argument object
return double

GetFuncName() protected method

protected GetFuncName ( ) : string
return string

GetInt() protected method

protected GetInt ( object argument ) : int
argument object
return int

PopStackAssert() protected method

A utility function that a function's Execute() should use in place of cpu.PopStack(), because it will assert that the value being popped is NOT an ARG_MARKER_STRING, and if it is, it will throw the appropriate error.
protected PopStackAssert ( SafeSharedObjects shared ) : object
shared SafeSharedObjects
return object

PopStructureAssertEncapsulated() protected method

Identical to PopValueAssert, but with the additional step of coercing the result into a Structure to be sure, so it won't return primitives.
protected PopStructureAssertEncapsulated ( SafeSharedObjects shared, bool barewordOkay = false ) : Structure
shared SafeSharedObjects
barewordOkay bool
return Structure

PopValueAssert() protected method

A utility function that a function's Execute() should use in place of cpu.PopValue(), because it will assert that the value being popped is NOT an ARG_MARKER_STRING, and if it is, it will throw the appropriate error.
protected PopValueAssert ( SafeSharedObjects shared, bool barewordOkay = false ) : object
shared SafeSharedObjects
barewordOkay bool
return object

RadiansToDegrees() protected method

protected RadiansToDegrees ( double radians ) : double
radians double
return double

SafeFunctionBase() protected method

protected SafeFunctionBase ( ) : System
return System