# class ScriptContext | Script execution context. More...
Contains pure virtuals
Full name | `TelEngine::ScriptContext`
Definition | `#include <libs/yscript/yatescript.h>`
Inherits | TelEngine::ExpExtender [public ], TelEngine::RefObject [public ]
Inherited by | JsArray, JsFunction, JsObject, JsRegExp
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- inline explicit ScriptContext (const char* name = 0)
- inline NamedList& params ()
- inline const NamedList& params () const
- virtual NamedList* nativeParams () const
- virtual const String& toString () const
- virtual void* getObject (const String& name) const
- virtual RefObject* refObj ()
- virtual Mutex* mutex ()
- virtual bool hasField (ObjList& stack, const String& name, GenObject* context) const
- virtual NamedString* getField (ObjList& stack, const String& name, GenObject* context) const
- virtual void fillFieldNames (ObjList& names)
- virtual bool runFunction (ObjList& stack, const ExpOperation& oper, GenObject* context)
- virtual bool runField (ObjList& stack, const ExpOperation& oper, GenObject* context)
- virtual bool runAssign (ObjList& stack, const ExpOperation& oper, GenObject* context)
- virtual bool copyFields (ObjList& stack, const ScriptContext& original, GenObject* context)
- bool runMatchingField (ObjList& stack, const ExpOperation& oper, GenObject* context)

#### Public Static Methods

- static void fillFieldNames (ObjList& names, const NamedList& list, const char* skip = 0)

## Detailed Description

A script execution context, holds global variables and objects

inline explicit ScriptContext (const char* name = 0) | ### ScriptContext

Constructor

Parameters:

name | Name of the context

inline NamedList& params () | ### params

Access to the NamedList operator

Returns: Reference to the internal named list

inline const NamedList& params () | ### params

[const]

Const access to the NamedList operator

Returns: Reference to the internal named list

NamedList* nativeParams () | ### nativeParams

[const virtual]

Access any native NamedList hold by the context

Returns: Pointer to a native named list

const String& toString () | ### toString

[const virtual]

Override GenObject's method to return the internal name of the named list

Returns: A reference to the context name

Reimplemented from GenObject.

void* getObject (const String& name) | ### getObject

[const virtual]

Get a pointer to a derived class given that class name

Parameters:

name | Name of the class we are asking for

Returns: Pointer to the requested class or NULL if this object doesn't implement it

Reimplemented from RefObject.

RefObject* refObj () | ### refObj

[virtual]

Retrieve the reference counted object owning this interface

Returns: Pointer to this script context

Reimplemented from ExpExtender.

Mutex* mutex () | ### mutex

[pure virtual]

Retrieve the Mutex object used to serialize object access, if any

Returns: Pointer to the mutex or NULL if none applies

bool hasField (ObjList& stack, const String& name, GenObject* context) | ### hasField

[const virtual]

Check if a certain field is assigned in context

Parameters:

stack | Evaluation stack in use
name | Name of the field to test
context | Pointer to arbitrary object passed from evaluation methods

Returns: True if the field is present

Reimplemented from ExpExtender.

NamedString* getField (ObjList& stack, const String& name, GenObject* context) | ### getField

[const virtual]

Get a pointer to a field in the context

Parameters:

stack | Evaluation stack in use
name | Name of the field to retrieve
context | Pointer to arbitrary object passed from evaluation methods

Returns: Pointer to field, NULL if not present

Reimplemented from ExpExtender.

void fillFieldNames (ObjList& names) | ### fillFieldNames

[virtual]

Fill a list with the unique names of all fields

Parameters:

names | List to which key names must be added

void fillFieldNames (ObjList& names, const NamedList& list, const char* skip = 0) | ### fillFieldNames

[static]

Fill a list with the unique names of all fields

Parameters:

names | List to which key names must be added
list | List of parameters whose names to be added
skip | Parameters starting with this prefix will not be added

bool runFunction (ObjList& stack, const ExpOperation& oper, GenObject* context) | ### runFunction

[virtual]

Try to evaluate a single function in the context

Parameters:

stack | Evaluation stack in use, parameters are popped off this stack and results are pushed back on stack
oper | Function to evaluate
context | Pointer to context data passed from evaluation methods

Returns: True if evaluation succeeded

Reimplemented from ExpExtender.

bool runField (ObjList& stack, const ExpOperation& oper, GenObject* context) | ### runField

[virtual]

Try to evaluate a single field in the context

Parameters:

stack | Evaluation stack in use, field value must be pushed on it
oper | Field to evaluate
context | Pointer to context data passed from evaluation methods

Returns: True if evaluation succeeded

Reimplemented from ExpExtender.

bool runAssign (ObjList& stack, const ExpOperation& oper, GenObject* context) | ### runAssign

[virtual]

Try to assign a value to a single field

Parameters:

stack | Evaluation stack in use
oper | Field to assign to, contains the field name and new value
context | Pointer to context data passed from evaluation methods

Returns: True if assignment succeeded

Reimplemented from ExpExtender.

bool copyFields (ObjList& stack, const ScriptContext& original, GenObject* context) | ### copyFields

[virtual]

Copy all fields from another context

Parameters:

stack | Evaluation stack in use
original | Script context to copy from
context | Pointer to context data passed from evaluation methods

Returns: True if all fields were copied

bool runMatchingField (ObjList& stack, const ExpOperation& oper, GenObject* context) | ### runMatchingField

Try to evaluate a single field searching for a matching context

Parameters:

stack | Evaluation stack in use, field value must be pushed on it
oper | Field to evaluate
context | Pointer to context data passed from evaluation methods

Returns: True if evaluation succeeded

Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.