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

#include <VOP_HDACodeCompiler.h>

+ Inheritance diagram for VOP_HDACodeCompiler:

Public Member Functions

 VOP_HDACodeCompiler ()
 
virtual ~VOP_HDACodeCompiler ()
 
virtual bool compileVexCodeToSections (OP_Node *srcnode, FS_IndexFile *hda, const char *context_mask=0)
 
virtual bool compileNewOperatorType (OP_Node *srcnode, const char *name, const char *label, const char *path, const char *metasrc, const VOP_ContextTypeList *types=NULL)
 
const UT_StringMap
< UT_StringHolder > & 
getFunctionsSectionsMap () const
 
void setShaderName (const char *shader_name)
 Main shader name used in compilation. More...
 
const UT_StringHoldergetShaderName () const
 Main shader name used in compilation. More...
 
UT_ErrorSeverity getStatus (UT_String &message, UT_String *details=0)
 
void setForceCompilationOnOpNameConflict (bool flag)
 
bool getForceCompilationOnOpNameConflict ()
 

Static Public Member Functions

static bool canCompileNode (OP_Node *srcnode)
 
static void removeCodeSections (OP_Node *node, FS_IndexFile *file)
 
static bool updateCodeSections (OP_Node *node, FS_IndexFile *file, UT_String *message)
 

Protected Member Functions

void saveVflCodeToSection (FS_IndexFile *hda, OP_Node *shader_node, VOP_CodeGenerator *code_generator, VOP_ContextType context_type, const char *section_name, OP_Node *output_node)
 Saves the code to section. More...
 
bool isOK () const
 Checks if there was an error during compilation up till now. More...
 
void setStatus (UT_ErrorSeverity sev, const char *msg, const char *details=0)
 
void clearStatus ()
 

Detailed Description

A class that compiles a node into a script-based HDA. This is a base class that presents two interface functions, compileVexCodeToSections() and compileNewOperatorType() and the derived class should implement at least one of them.

Definition at line 42 of file VOP_HDACodeCompiler.h.

Constructor & Destructor Documentation

VOP_HDACodeCompiler::VOP_HDACodeCompiler ( )
virtual VOP_HDACodeCompiler::~VOP_HDACodeCompiler ( )
virtual

Member Function Documentation

static bool VOP_HDACodeCompiler::canCompileNode ( OP_Node srcnode)
static

Tests if the node can be compiled into vex code sections.

Returns
True if node can be compiled; otherwise, false.
void VOP_HDACodeCompiler::clearStatus ( )
protected

Allow subclasses to set the error and warning messages.

virtual bool VOP_HDACodeCompiler::compileNewOperatorType ( OP_Node srcnode,
const char *  name,
const char *  label,
const char *  path,
const char *  metasrc,
const VOP_ContextTypeList types = NULL 
)
virtual

Compiles a given node to a new script-based HDA (ie, the content nodes are not saved; only the vex code that they generate is saved). This is used for HDAs that don't have contents network, and only use the compiled code for cooking.

Parameters
srcnodeThe node from which to create the new HDA.
nameThe name of the new operator.
labelThe label of the new operator.
pathThe file path of the OTL to which the new HDA is saved.
metasrcThe meta source for the OTL containing new HDA.
typesThe shader context types to save. If NULL, all implemented context types are saved.
Returns
True if creation of new HDA succeeded. On failure, false is returned and the member error message is set.

Reimplemented in VOP_ShaderHDACompilerOTL.

virtual bool VOP_HDACodeCompiler::compileVexCodeToSections ( OP_Node srcnode,
FS_IndexFile hda,
const char *  context_mask = 0 
)
virtual

Compiles a given node to the sections of a given HDA (already existing). This is used for HDAs that have contents network, but also want to store cached vfl/vex code.

Parameters
srcnodeThe node from which to obtain vex code.
hdaThe HDA definition to which save the vfl and vex code.

Reimplemented in VOP_ShaderHDACompilerHDA, and VOP_VopHDACompiler.

bool VOP_HDACodeCompiler::getForceCompilationOnOpNameConflict ( )
inline

Configures the flag to force creation of the new operator even if there is already one by that name.

Definition at line 65 of file VOP_HDACodeCompiler.h.

const UT_StringMap<UT_StringHolder>& VOP_HDACodeCompiler::getFunctionsSectionsMap ( ) const
inline

Obtains info about imported shaders that needed to be also compiled and saved in HDA sections. Eg, imported shaders that are implemented as nested Material Builders (or HDAs based on them). The keys are the shader function names and mapped values are the section names where they are stored.

Definition at line 119 of file VOP_HDACodeCompiler.h.

const UT_StringHolder& VOP_HDACodeCompiler::getShaderName ( ) const
inline

Main shader name used in compilation.

Definition at line 51 of file VOP_HDACodeCompiler.h.

UT_ErrorSeverity VOP_HDACodeCompiler::getStatus ( UT_String message,
UT_String details = 0 
)

Returns an error or a warning message from the last compilation.

bool VOP_HDACodeCompiler::isOK ( ) const
inlineprotected

Checks if there was an error during compilation up till now.

Definition at line 140 of file VOP_HDACodeCompiler.h.

static void VOP_HDACodeCompiler::removeCodeSections ( OP_Node node,
FS_IndexFile file 
)
static

Utility function for cleaning up HDA of any compiled sections. node The node defined by the HDA saved in file. It is used to determine the section name convention for the given type of HDA (shader vs. vop).

void VOP_HDACodeCompiler::saveVflCodeToSection ( FS_IndexFile hda,
OP_Node shader_node,
VOP_CodeGenerator code_generator,
VOP_ContextType  context_type,
const char *  section_name,
OP_Node output_node 
)
protected

Saves the code to section.

void VOP_HDACodeCompiler::setForceCompilationOnOpNameConflict ( bool  flag)
inline

Configures the flag to force creation of the new operator even if there is already one by that name.

Definition at line 63 of file VOP_HDACodeCompiler.h.

void VOP_HDACodeCompiler::setShaderName ( const char *  shader_name)
inline

Main shader name used in compilation.

Definition at line 49 of file VOP_HDACodeCompiler.h.

void VOP_HDACodeCompiler::setStatus ( UT_ErrorSeverity  sev,
const char *  msg,
const char *  details = 0 
)
protected

Allow subclasses to set the error and warning messages.

static bool VOP_HDACodeCompiler::updateCodeSections ( OP_Node node,
FS_IndexFile file,
UT_String message 
)
static

Utility function for compiling node to code sections, but also to update function name section if needed. Returns true on success; false otherwise (along with error message)


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