HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VEX_VexOp Class Reference

Use this class to extend VEX by adding custom VEX functions. More...

#include <VEX_VexOp.h>

Public Member Functions

 ~VEX_VexOp ()
 Standard destructor. More...
 
void setCompleted (VEX_VexOpCompleted cback)
 
const UT_StringHoldergetSignature () const
 Query the signature. More...
 
int getContextMask () const
 Query the context mask. More...
 
VEX_VexOpInit getInit () const
 Query the initialization function. More...
 
VEX_VexOpCallback getEvaluator () const
 Query the evaluation function. More...
 
VEX_VexOpTypedCallback getTypedEvaluator () const
 Query the typed evaluation function. More...
 
VEX_VexOpCleanup getCleanup () const
 Query the cleanup function. More...
 
VEX_VexOpCompleted getCompleted () const
 Query the completed function. More...
 
int getOptimizer () const
 Query the optimization level. More...
 
 VEX_VexOp (const UT_StringHolder &signature, VEX_VexOpCallback evaluator, int ctx_mask=(VEX_ALL_CONTEXT), VEX_VexOpInit init=0, VEX_VexOpCleanup cleanup=0, int optimize_level=VEX_OPTIMIZE_2, bool force_return_code=false)
 
 VEX_VexOp (const UT_StringHolder &signature, VEX_VexOpTypedCallback evaluator, int ctx_mask=(VEX_ALL_CONTEXT), VEX_VexOpInit init=0, VEX_VexOpCleanup cleanup=0, int optimize_level=VEX_OPTIMIZE_2, bool force_return_code=false)
 

Static Public Member Functions

static const char * stringAlloc (const char *str)
 
static void stringFree (const char *str)
 Function to free an allocated string. More...
 
static VEX_ErrorLoggetErrorLog ()
 
static int getNumVexOps ()
 
static const VEX_VexOpgetVexOp (int idx)
 Query the Nth function. More...
 
static const char * getVexOpLocation (int idx)
 Get the path to the DSO associated with the VEX plug-in. More...
 

Protected Attributes

UT_StringHolder mySignature
 
VEX_VexOpInit myInit
 
VEX_VexOpCallback myEvaluator
 
VEX_VexOpTypedCallback myTypedEvaluator
 
VEX_VexOpCleanup myCleanup
 
VEX_VexOpCompleted myCompleted
 
int myContextMask
 
int myOptimizeLevel
 
unsigned int myFlags
 

Detailed Description

Use this class to extend VEX by adding custom VEX functions.

Examples:
alligator/alligator.C, VEX/VEX_Example.C, VEX/VEX_Ops.C, and VEX/VEX_Sort.C.

Definition at line 144 of file VEX_VexOp.h.

Constructor & Destructor Documentation

VEX_VexOp::VEX_VexOp ( const UT_StringHolder signature,
VEX_VexOpCallback  evaluator,
int  ctx_mask = (VEX_ALL_CONTEXT),
VEX_VexOpInit  init = 0,
VEX_VexOpCleanup  cleanup = 0,
int  optimize_level = VEX_OPTIMIZE_2,
bool  force_return_code = false 
)

Function declaration

Parameters
signature
The function name and parameters expected
evaluator
The evaluation callback
ctx_mask
Which contexts this function is available in
init
Initialization callback (called for every instance)
cleanup
Cleanup callback
optimize_level
Optimization level
force_return_code
For signatures which have multiple write-only variables, this bool forces the first write-only variable to be interpreted as a return code.
VEX_VexOp::VEX_VexOp ( const UT_StringHolder signature,
VEX_VexOpTypedCallback  evaluator,
int  ctx_mask = (VEX_ALL_CONTEXT),
VEX_VexOpInit  init = 0,
VEX_VexOpCleanup  cleanup = 0,
int  optimize_level = VEX_OPTIMIZE_2,
bool  force_return_code = false 
)

Function declaration

Parameters
signature
The function name and parameters expected
evaluator
The evaluation callback
ctx_mask
Which contexts this function is available in
init
Initialization callback (called for every instance)
cleanup
Cleanup callback
optimize_level
Optimization level
force_return_code
For signatures which have multiple write-only variables, this bool forces the first write-only variable to be interpreted as a return code.
VEX_VexOp::~VEX_VexOp ( )

Standard destructor.

Member Function Documentation

VEX_VexOpCleanup VEX_VexOp::getCleanup ( ) const
inline

Query the cleanup function.

Definition at line 194 of file VEX_VexOp.h.

VEX_VexOpCompleted VEX_VexOp::getCompleted ( ) const
inline

Query the completed function.

Definition at line 196 of file VEX_VexOp.h.

int VEX_VexOp::getContextMask ( ) const
inline

Query the context mask.

Definition at line 185 of file VEX_VexOp.h.

static VEX_ErrorLog& VEX_VexOp::getErrorLog ( )
static

During execution of a callback, this method can be used to retrieve the current VEX error log for error reporting. This method will only operate correctly in the thread that executed the callback.

VEX_VexOpCallback VEX_VexOp::getEvaluator ( ) const
inline

Query the evaluation function.

Definition at line 189 of file VEX_VexOp.h.

VEX_VexOpInit VEX_VexOp::getInit ( ) const
inline

Query the initialization function.

Definition at line 187 of file VEX_VexOp.h.

static int VEX_VexOp::getNumVexOps ( )
static

These functions can be used to query the number of DSO's loaded by VEX and the locations of the shared objects loaded.

int VEX_VexOp::getOptimizer ( ) const
inline

Query the optimization level.

Definition at line 198 of file VEX_VexOp.h.

const UT_StringHolder& VEX_VexOp::getSignature ( ) const
inline

Query the signature.

Definition at line 183 of file VEX_VexOp.h.

VEX_VexOpTypedCallback VEX_VexOp::getTypedEvaluator ( ) const
inline

Query the typed evaluation function.

Definition at line 191 of file VEX_VexOp.h.

static const VEX_VexOp* VEX_VexOp::getVexOp ( int  idx)
static

Query the Nth function.

static const char* VEX_VexOp::getVexOpLocation ( int  idx)
static

Get the path to the DSO associated with the VEX plug-in.

void VEX_VexOp::setCompleted ( VEX_VexOpCompleted  cback)
inline

Set the completed callback, called when all evaluate calls for a given shader invokation are finished.

Definition at line 179 of file VEX_VexOp.h.

static const char* VEX_VexOp::stringAlloc ( const char *  str)
static

When dealing assigning to string arguments, you must "free" the previous string value by calling "stringFree". You must set the resulting string to the return code from "stringAlloc". If you do your own memory management (i.e. calling strdup() or setting strings to constant values), you will most likely crash VEX. For example:

void
vexStrCat(int argc, void *argv[], void *)
{
// arg[0] = result, arg[1..2] == strings to concat
char work_buf[256];
VEX_VexOp::stringFree((char *)argv[0]);
strcpy(work_buf, (char *)argv[1]);
strcat(work_buf, (char *)argv[2]);
argv[0] = VEX_VexOp::stringAlloc(work_buf);
}
Examples:
VEX/VEX_Sort.C.
static void VEX_VexOp::stringFree ( const char *  str)
static

Function to free an allocated string.

Member Data Documentation

VEX_VexOpCleanup VEX_VexOp::myCleanup
protected

Definition at line 251 of file VEX_VexOp.h.

VEX_VexOpCompleted VEX_VexOp::myCompleted
protected

Definition at line 252 of file VEX_VexOp.h.

int VEX_VexOp::myContextMask
protected

Definition at line 256 of file VEX_VexOp.h.

VEX_VexOpCallback VEX_VexOp::myEvaluator
protected

Definition at line 249 of file VEX_VexOp.h.

unsigned int VEX_VexOp::myFlags
protected

Definition at line 258 of file VEX_VexOp.h.

VEX_VexOpInit VEX_VexOp::myInit
protected

Definition at line 248 of file VEX_VexOp.h.

int VEX_VexOp::myOptimizeLevel
protected

Definition at line 257 of file VEX_VexOp.h.

UT_StringHolder VEX_VexOp::mySignature
protected

Definition at line 245 of file VEX_VexOp.h.

VEX_VexOpTypedCallback VEX_VexOp::myTypedEvaluator
protected

Definition at line 250 of file VEX_VexOp.h.


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