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

Wraps a nkMemory::BufferView<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 void destructor (void *toDestroy)
 
static nkScripts::OutputValue view (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue subView (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getData (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getSize (const nkScripts::DataStack &stack)
 

Detailed Description

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

Wraps a nkMemory::BufferView<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 BufferView within the environment, given the names provided.

Member Function Documentation

◆ updateEnvironment()

template<typename T >
static void nkAstraeus::nkMemoryWrap::BufferViewWrapper< 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.

◆ destructor()

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

Wrapper function for the destructor of the user type.

Parameters
toDestroyThe data that has to be freed.

◆ view()

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

Wrapper conversion constructor from a nkMemory::Buffer.

local d = nkMemory.BufferView.view(buffer) ;
Parameters
stackThe parameter stack.
Returns
A nkMemory::BufferView over the buffer passed as a parameter.

◆ subView()

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

Wrapper conversion constructor from a sub-part of a nkMemory::Buffer.

local d = nkMemory.BufferView.subView(buffer, start, length) ;
Parameters
stackThe parameter stack.
Returns
A nkMemory::BufferView over the sub-part of the buffer passed as a parameter.

◆ getData()

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

Wrapper function for the nkMemory::BufferView::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::BufferViewWrapper< T >::getSize ( const nkScripts::DataStack stack)
static

Wrapper function for the nkMemory::BufferView::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: