defs/si_sha/sreqpool.h File Reference

A script request object and pool. More...

#include <si_sys/pthrdsem.h>
#include <si_sys/blkalloc.h>
#include <si_std/string.h>
#include <si_std/ptrh.h>
#include <si_std/listt.h>
#include <si_sha/autopkt.h>

Go to the source code of this file.

Classes

struct  sc_scriptRequest
 A script request object. More...
struct  sc_scriptRequestPool
 A pool of script request objects. More...

Enumerations

enum  se_scriptRequestFlags { se_scriptRequest_ReturnJSON = 1, se_scriptRequest_RelayMessage = 2 }
 Enumeration of flag bits for script requests. More...

Functions

sc_status sc_scriptRequest_clear (sc_scriptRequest *psr)
 sm_ptrhDecl (sc_scriptRequest)
 Macro declares sc_scriptRequestPtrh: script request pointer-handle objects.
 sm_listDecl (sc_scriptRequestPtrh)
 Macro declares sc_scriptRequestPtrhList: a list of script request pointer-handle objects.
sc_status sc_scriptRequestPool_construct (sc_scriptRequestPool *ppool, s_int32 initialCapacity, s_int32 maxCapacity)
sc_status sc_scriptRequestPool_destruct (sc_scriptRequestPool *ppool)
sc_status sc_scriptRequestPool_allocate (sc_scriptRequestPool *ppool, sc_scriptRequestPtrh *pptrh)
sc_status sc_scriptRequestPool_free (sc_scriptRequestPool *ppool, sc_scriptRequestPtrh *pptrh)


Detailed Description

A script request object and pool.

Script request objects are used to feed JavaScript commands to the JavaScript context.


Enumeration Type Documentation

Enumeration of flag bits for script requests.

Requests can have JSON response formatting turned on/off. Requests can be packets relayed from the network or scripts.


Function Documentation

sc_status sc_scriptRequest_clear ( sc_scriptRequest psr  ) 

Clear the script request object, resetting it to newly constructed state, without changing capacity.

Parameters:
[in,out] psr Script request object to clear.

sc_status sc_scriptRequestPool_allocate ( sc_scriptRequestPool ppool,
sc_scriptRequestPtrh *  pptrh 
)

Allocates a request from the script request pool.

Parameters:
[in,out] ppool The pool to allocate from.
[out] pptrh The pointer-handle to assign the allocated request to.

sc_status sc_scriptRequestPool_construct ( sc_scriptRequestPool ppool,
s_int32  initialCapacity,
s_int32  maxCapacity 
)

Constructs a script request pool with the given initialCapacity of requests growable up to maxCapacity.

Parameters:
[in,out] ppool The script request pool to construct.
[in] initialCapacity The number of requests to ready on construction.
[in] maxCapacity The maximum number of requests to allow the pool to grow to.

sc_status sc_scriptRequestPool_destruct ( sc_scriptRequestPool ppool  ) 

Destructs the given sc_scriptRequestPool.

Parameters:
[in,out] ppool The script request pool to destruct.
Note:
All requests must be returned to the pool before destruction.

sc_status sc_scriptRequestPool_free ( sc_scriptRequestPool ppool,
sc_scriptRequestPtrh *  pptrh 
)

Releases a request back to the sc_scriptRequestPool.

Parameters:
[in,out] ppool The pool to return the request to.
[in] pptrh The pointer-handle to the request being returned.


doxygen