defs/si_sha/lase.h File Reference

LASE class. More...

#include <si_std/queuet.h>
#include <si_sha/sreqpool.h>
#include <si_sha/adevmgr.h>
#include <pthread.h>
#include <jsapi.h>

Go to the source code of this file.

Classes

struct  sc_lase
 The LASE class. More...

Enumerations

enum  se_laseState { se_laseStateStopping, se_laseStateStopped, se_laseStateStarting, se_laseStateStarted }
 Enum describing start/stop state of LASE.

Functions

 sm_queueDecl (sc_scriptRequestPtrh)
sc_status sc_lase_construct (sc_lase *pl, s_uint32 envSize, const TCHAR *basePath)
sc_status sc_lase_destruct (sc_lase *pl)
sc_status sc_lase_start (sc_lase *pl)
sc_status sc_lase_stop (sc_lase *pl)
sc_status sc_lase_allocRequest (sc_lase *pl, sc_scriptRequestPtrh *ptrh)
sc_status sc_lase_submitRequest (sc_lase *pl, sc_scriptRequestPtrh *ptrh)
sc_status sc_lase_executeRequest (sc_lase *pl, sc_scriptRequestPtrh *ptrh)


Detailed Description

LASE class.

The LASE class is the center of the automation scripting environment. It holds the JavaScript runtime, context, and global objects, the device manager for name and type mapping and maintains the thread that runs the JavaScript engine, and the script queue that feeds it.

The LASE object also initializes the system by reading the 'bridges' table in the database, and creating instances of any bridges it finds. It also installs a number of helper function into the global JavaScript namespace:


Function Documentation

sc_status sc_lase_allocRequest ( sc_lase pl,
sc_scriptRequestPtrh *  ptrh 
)

Allocate a script request object for later submission.

Parameters:
[in,out] pl The LASE system to allocate from.
[in] ptrh The pointer-handle to which the allocated request will be assigned.
Note:
This runs in constant time.

sc_status sc_lase_construct ( sc_lase pl,
s_uint32  envSize,
const TCHAR *  basePath 
)

Construct the LASE system with the given JavaScript environment size, with LASE data based at basePath.

Parameters:
[in,out] pl The LASE object to construct.
[in] envSize The JavaScript environment size.
[in] basePath The base path of the lase data directory structure.
Note:
In a standard installed system, basePath will be /var/lib/lase. On a development system, it could be the src/lase directory of your source tree.

To avoid excessive garbage collection, try setting envSize to 4MB or more.

sc_status sc_lase_destruct ( sc_lase pl  ) 

Destruct the LASE object pl.

sc_status sc_lase_executeRequest ( sc_lase pl,
sc_scriptRequestPtrh *  ptrh 
)

Executes the script request referenced by ptrh in LASE pl.

This executes the script synchronously. That is, it submits the script request and *does* wait for it to complete.

Parameters:
[in,out] pl The LASE system in which the script is executed.
[in] ptrh A reference to the script to execute.
Note:
You are guaranteed that scripts will be executed in the order they are submitted.
See also:
sc_lase_submitRequest to submit the request without having to wait.

sc_status sc_lase_start ( sc_lase pl  ) 

Start the lase system pl. The system must be started before it will process any script requests.

sc_status sc_lase_stop ( sc_lase pl  ) 

Stop the lase system pl. Any outstanding script requests will be ignored.

sc_status sc_lase_submitRequest ( sc_lase pl,
sc_scriptRequestPtrh *  ptrh 
)

Submit the script request referenced by ptrh for execution in pl.

This submits the script for execution, but does *not* wait for it to complete.

Parameters:
[in,out] pl The LASE system in which the script will be executed.
[in] ptrh A reference to the script to submit for execution.
Note:
You are guaranteed that scripts will be executed in the order they are submitted.
See also:
sc_lase_executeRequest

sm_queueDecl ( sc_scriptRequestPtrh   ) 

Macro declares sc_scriptRequestPtrhQueue, a queue of script request pointer-handles.


doxygen