Yate
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
ScriptRun Class Reference

Script runtime execution. More...

#include <yatescript.h>

Inheritance diagram for ScriptRun:
GenObject Mutex Lockable

List of all members.

Public Types

enum  Status {
  Invalid, Running, Incomplete, Succeeded,
  Failed
}

Public Member Functions

 ScriptRun (ScriptCode *code, ScriptContext *context=0)
virtual ~ScriptRun ()
ScriptCodecode () const
ScriptContextcontext () const
Status state () const
const char * textState () const
ObjListstack ()
const ObjListstack () const
ScriptRunclone () const
Status reset ()
Status execute ()
Status run ()
bool runAssign (const ExpOperation &oper, GenObject *context=0)

Static Public Member Functions

static const char * textState (Status state)

Protected Member Functions

Status resume ()

Friends

class ScriptCode

Detailed Description

Script runtime execution.

An instance of script code and data, status machine run by a single thread at a time


Member Enumeration Documentation

enum Status

Runtime states


Constructor & Destructor Documentation

ScriptRun ( ScriptCode code,
ScriptContext context = 0 
)

Constructor

Parameters:
codeCode fragment to execute
contextScript context, an empty one will be allocated if NULL
virtual ~ScriptRun ( ) [virtual]

Destructor, disposes the code and context


Member Function Documentation

ScriptRun* clone ( ) const [inline]

Create a duplicate of the runtime with its own stack and state

Returns:
New clone of the runtime
ScriptCode* code ( ) const [inline]

Retrieve the parsed code being executed

Returns:
Pointer to ScriptCode object
ScriptContext* context ( ) const [inline]

Retrieve the execution context associated with the runtime

Returns:
Pointer to ScriptContext object

Execute script from where it was left, may stop and return Incomplete state

Returns:
Status of the runtime after code execution

Resets code execution to the beginning, does not clear context

Returns:
Status of the runtime after reset
Status resume ( ) [protected]

Resume script from where it was left, may stop and return Incomplete state

Returns:
Status of the runtime after code execution
Status run ( )

Execute script from the beginning until it returns a final state

Returns:
Final status of the runtime after code execution
bool runAssign ( const ExpOperation oper,
GenObject context = 0 
)

Try to assign a value to a single field in the script context

Parameters:
operField to assign to, contains the field name and new value
contextPointer to arbitrary object to be passed to called methods
Returns:
True if assignment succeeded
ObjList& stack ( ) [inline]

Access the runtime execution stack

Returns:
The internal execution stack
const ObjList& stack ( ) const [inline]

Const access the runtime execution stack

Returns:
The internal execution stack
Status state ( ) const [inline]

Current state of the runtime

static const char* textState ( Status  state) [static]

Get the text description of a runtime state

Parameters:
stateState to describe
Returns:
Description of the runtime state
const char* textState ( ) const [inline]

Get the text description of the current runtime state

Returns:
Description of the runtime state

References ScriptRun::textState().

Referenced by ScriptRun::textState().


The documentation for this class was generated from the following file: