Class jac::MachineBase
ClassList > jac > MachineBase
Public Functions
Type | Name |
---|---|
MachineBase () = default |
|
MachineBase (const MachineBase &) = delete |
|
MachineBase (MachineBase &&) = delete |
|
ContextRef | context () Get the ContextRef for this machine. |
Value | eval (std::string code, std::string filename, EvalFlags flags=EvalFlags::Global) Evaluate a string containing javascript code. |
void | initialize () Initialize the machine. Should be called after machine configuration is done and before any interaction with the javascript engine. Other MFeatures in the Machine stack can implement this method to initialize themselves but the first call should be Next::initialize(). |
void | interruptRuntime () Interrupt running javascript code. Execution will be thrown in the javascript as an InterruptError. |
Module & | newModule (std::string name) Create a new module in the machine. |
MachineBase & | operator= (const MachineBase &) = delete |
MachineBase & | operator= (MachineBase &&) = delete |
void | resetWatchdog () Reset the watchdog timer. This should be called periodically to prevent the watchdog from triggering. |
JSRuntime * | runtime () Get the JSRuntime* for this machine. |
void | setWatchdogHandler (std::function< bool()> callback) Set the watchdog callback. The callback will be called when the watchdog timeout has passed since the last reset. If the callback returns true, the runtime will be interrupted. |
void | setWatchdogTimeout (std::chrono::milliseconds timeout) Set the watchdog timeout. If the timeout is zero, the watchdog is disabled. Otherwise, the watchdog will be called when the timeout has passed since the last reset. |
virtual | ~MachineBase () |
Public Functions Documentation
function MachineBase [1/3]
function MachineBase [2/3]
function MachineBase [3/3]
function context
Get the ContextRef for this machine.
Returns:
The ContextRef
function eval
Evaluate a string containing javascript code.
Value jac::MachineBase::eval (
std::string code,
std::string filename,
EvalFlags flags=EvalFlags::Global
)
Parameters:
code
the code to evaluatefilename
filename to use for the code. Used for error reportingflags
flags to evaluate the code with
Returns:
Result of the evaluation
function initialize
function interruptRuntime
function newModule
Create a new module in the machine.
Parameters:
name
name of the module
Returns:
Reference to the new module
function operator=
function operator=
function resetWatchdog
function runtime
Get the JSRuntime* for this machine.
Returns:
The JSRuntime*
function setWatchdogHandler
Set the watchdog callback. The callback will be called when the watchdog timeout has passed since the last reset. If the callback returns true, the runtime will be interrupted.
Parameters:
callback
callback to call
function setWatchdogTimeout
Set the watchdog timeout. If the timeout is zero, the watchdog is disabled. Otherwise, the watchdog will be called when the timeout has passed since the last reset.
Parameters:
timeout
watchdog timeout
function ~MachineBase
Friends Documentation
friend Module
The documentation for this class was generated from the following file src/jac/machine/machine.h