API Documentation
Static Public Member Functions | List of all members
nkAstraeus::nkTasksWrap::SchedulerTaskWrapper Class Referencefinal

Wraps a nkTasks::Task and offers functions for use in scripting. More...

Static Public Member Functions

static void updateEnvironment (nkScripts::Environment *env, LogManager *targetLogManager)
 
static void * constructor (nkScripts::Environment *env, LogManager *targetLogManager, const nkScripts::DataStack &stack)
 
static void destructor (void *toDestroy)
 
static nkScripts::OutputValue getWorkResult (void *data)
 
static nkScripts::OutputValue getInputBinaryData (void *data)
 
static nkScripts::OutputValue getOutputBinaryData (void *data)
 
static void setWorkFunc (const nkScripts::DataStack &stack)
 
static void setInitScript (const nkScripts::DataStack &stack)
 
static void setInputBinaryData (const nkScripts::DataStack &stack)
 
static void setOutputBinaryData (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue addInputUserData (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue addOutputUserData (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getInputUserData (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getOutputUserData (const nkScripts::DataStack &stack)
 

Detailed Description

Wraps a nkTasks::Task and offers functions for use in scripting.

Currently focused on Lua, in which threads are not allowed. As such, memory management within tasks has to be done cautiously. Be sure to manage correctly user data ownership when passing them around. Lua objects need to be serialized before being communicated. Typically :

local d = {} ;
d.str = "Hey" ;
d.obj = nkGraphics.Vector.new() ;
task.inputBinaryData = nkScripts.serialize(d) ;

If ownership of user data has to be passed around, use serializeForwardOwnership().

Member Function Documentation

◆ updateEnvironment()

static void nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::updateEnvironment ( nkScripts::Environment env,
LogManager targetLogManager 
)
static

Updates a given environment and set it up to use all functions wrapped by this wrapper.

Parameters
envThe environment to set up.
targetLogManagerThe target log manager, should logging happen within the populated methods.

◆ constructor()

static void* nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::constructor ( nkScripts::Environment env,
LogManager targetLogManager,
const nkScripts::DataStack stack 
)
static

Wrapper function for the constructor of the user type.

local t = nkTasks.Task.new() ;
Parameters
envThe calling environment.
targetLogManagerThe target log manager, should logging happen within the populated methods.
stackThe parameter stack.
Returns
An output value with the user type and data allocated.

◆ destructor()

static void nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::destructor ( void *  toDestroy)
static

Wrapper function for the destructor of the user type.

Parameters
toDestroyThe data that has to be freed.

◆ getWorkResult()

static nkScripts::OutputValue nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::getWorkResult ( void *  data)
static

Wrapper function for the nkTasks::Task::getWorkResult(), exposed as an attribute getter.

local d = t._workResult ;
Parameters
dataThe data from which the attribute will be retrieved.
Returns
The attribute value, as a nkTasks::TASK_RESULT.

◆ getInputBinaryData()

static nkScripts::OutputValue nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::getInputBinaryData ( void *  data)
static

Wrapper function for the nkAstraeus::lua::nkTasksWrap::LuaTask::getInputBinaryData(), exposed as an attribute getter.

local d = t._inputBinaryData ;
Parameters
dataThe data from which the attribute will be retrieved.
Returns
The attribute value, as a nkAstraeus::UbyteArrayData.

◆ getOutputBinaryData()

static nkScripts::OutputValue nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::getOutputBinaryData ( void *  data)
static

Wrapper function for the nkAstraeus::lua::nkTasksWrap::LuaTask::getOutputBinaryData(), exposed as an attribute getter.

local d = t._outputBinaryData ;
Parameters
dataThe data from which the attribute will be retrieved.
Returns
The attribute value, as a nkAstraeus::UbyteArrayData.

◆ setWorkFunc()

static void nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::setWorkFunc ( const nkScripts::DataStack stack)
static

Wrapper function for nkAstraeus::lua::nkTasksWrap::LuaTask::setWorkFuncReference(), exposed as an attribute setter.

t._workFunc = function () print("r") end ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ setInitScript()

static void nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::setInitScript ( const nkScripts::DataStack stack)
static

Wrapper function for nkAstraeus::lua::nkTasksWrap::LuaTask::setInitScript(), exposed as an attribute setter.

t._initScript = script ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ setInputBinaryData()

static void nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::setInputBinaryData ( const nkScripts::DataStack stack)
static

Wrapper function for nkAstraeus::lua::nkTasksWrap::LuaTask::setInputBinaryData(), exposed as an attribute setter.

t._inputBinaryData = nkScripts.serialize(d) ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ setOutputBinaryData()

static void nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::setOutputBinaryData ( const nkScripts::DataStack stack)
static

Wrapper function for nkAstraeus::lua::nkTasksWrap::LuaTask::setOutputBinaryData(), exposed as an attribute setter.

t._outputBinaryData = nkScripts.serialize(d) ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ addInputUserData()

static nkScripts::OutputValue nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::addInputUserData ( const nkScripts::DataStack stack)
static

Wrapper function for nkAstraeus::lua::nkTasksWrap::LuaTask::addInputUserData().

t:addInputUserData(ptr, false) ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ addOutputUserData()

static nkScripts::OutputValue nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::addOutputUserData ( const nkScripts::DataStack stack)
static

Wrapper function for nkAstraeus::lua::nkTasksWrap::LuaTask::addOutputUserData().

t:addOutputUserData(ptr, false) ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ getInputUserData()

static nkScripts::OutputValue nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::getInputUserData ( const nkScripts::DataStack stack)
static

Wrapper function for nkAstraeus::lua::nkTasksWrap::LuaTask::getInputUserData().

local ptr = t:getInputUserData(0) ;
Parameters
stackThe parameter stack.
Returns
The output value, as the user data type given.

◆ getOutputUserData()

static nkScripts::OutputValue nkAstraeus::nkTasksWrap::SchedulerTaskWrapper::getOutputUserData ( const nkScripts::DataStack stack)
static

Wrapper function for nkAstraeus::lua::nkTasksWrap::LuaTask::getOutputUserData().

local ptr = t:getOutputUserData(0) ;
Parameters
stackThe parameter stack.
Returns
The output value, as the user data type given.

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