API Documentation
Static Public Member Functions | List of all members
nkAstraeus::nkMemoryWrap::BufferCastWrapper< T > Class Template Referencefinal

Wraps a nkMemory::BufferCast<T> and offers functions for use in scripting. More...

Static Public Member Functions

static void updateEnvironment (nkScripts::Environment *env, nkMemory::StringView typeName, nkMemory::StringView typeNameUserObject="")
 
static nkScripts::OutputValue constructor (const nkScripts::DataStack &stack)
 
static void destructor (void *toDestroy)
 
static nkScripts::OutputValue getData (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getSize (const nkScripts::DataStack &stack)
 

Detailed Description

template<typename T>
class nkAstraeus::nkMemoryWrap::BufferCastWrapper< T >

Wraps a nkMemory::BufferCast<T> and offers functions for use in scripting.

This wrapper is a template like the class it wraps. In Lua, the class needs to be instanciated. As such, this wrapper template will register a type of BufferCast within the environment, given the names provided.

Member Function Documentation

◆ updateEnvironment()

template<typename T >
static void nkAstraeus::nkMemoryWrap::BufferCastWrapper< T >::updateEnvironment ( nkScripts::Environment env,
nkMemory::StringView  typeName,
nkMemory::StringView  typeNameUserObject = "" 
)
static

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

Parameters
envThe environment to set up.
typeNameThe name to give to the type in the scripting environment.
typeNameUserObjectThe name of the contained object type, if any.

◆ constructor()

template<typename T >
static nkScripts::OutputValue nkAstraeus::nkMemoryWrap::BufferCastWrapper< T >::constructor ( const nkScripts::DataStack stack)
static

Wrapper static function for the empty size constructor of nkMemory::BufferCast.

local t = nkMemory.BufferCast[type].new(elementCount) ;
Parameters
stackThe parameter stack.
Returns
An output value with the user type and data allocated.

◆ destructor()

template<typename T >
static void nkAstraeus::nkMemoryWrap::BufferCastWrapper< T >::destructor ( void *  toDestroy)
static

Wrapper function for the destructor of the user type.

Parameters
toDestroyThe data that has to be freed.

◆ getData()

template<typename T >
static nkScripts::OutputValue nkAstraeus::nkMemoryWrap::BufferCastWrapper< T >::getData ( const nkScripts::DataStack stack)
static

Wrapper function for the nkMemory::BufferCast::getData() function.

local d = t:getData() ;
Parameters
stackThe parameter stack.
Returns
The getter value, as a T* (converted in a string for Lua).

◆ getSize()

template<typename T >
static nkScripts::OutputValue nkAstraeus::nkMemoryWrap::BufferCastWrapper< T >::getSize ( const nkScripts::DataStack stack)
static

Wrapper function for the nkMemory::BufferCast::getSize() function.

local s = t:getSize() ;
Parameters
stackThe parameter stack.
Returns
The getter value.

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