Vuo 2.4.4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
VuoModuleCompiler Class Referenceabstract

Description

Base class for compiling node classes from various source formats.

Definition at line 20 of file VuoModuleCompiler.hh.

Public Member Functions

virtual VuoModuleCompilerResults compile (dispatch_queue_t llvmQueue, VuoCompilerIssues *issues)=0
 Compiles the source file to LLVM bitcode that can be loaded as a Vuo node class.
 
virtual string generateHeader (VuoCompilerIssues *issues)
 Throws an exception.
 
virtual void overrideSourceCode (const string &sourceCode, const string &sourcePath)=0
 When compiling, sourceCode will be used instead of the contents of the source file.
 

Static Public Member Functions

static VuoModuleCompilernewModuleCompiler (const string &type, const string &moduleKey, const string &sourcePath, const VuoModuleCompilerSettings &settings, std::function< VuoCompilerType *(const string &)> getVuoType)
 If a VuoModuleCompiler subclass that is able to handle type and sourcePath is registered, creates an instance of that subclass.
 

Protected Types

typedef VuoModuleCompiler *(* Factory) (const string &moduleKey, const string &sourcePath, const VuoModuleCompilerSettings &settings)
 A method that creates an instance of a subclass of VuoModuleCompiler.
 

Protected Member Functions

 VuoModuleCompiler (const string &moduleKey, const string &sourcePath, const VuoModuleCompilerSettings &settings)
 Constructor to be called by derived classes.
 
VuoCompilerTypelookUpVuoType (const string &typeName)
 Adds the VuoCompilerType with the given name to vuoTypes.
 

Static Protected Member Functions

static void registerModuleCompiler (string type, Factory factory)
 Registers a method that creates an instance of a subclass of VuoModuleCompiler.
 

Protected Attributes

string moduleKey
 The module key of the module to compile.
 
string sourcePath
 The path of the primary source file to compile.
 
VuoModuleCompilerSettings settings
 Settings to use when compiling the module (specific to the type of module compiler).
 
map< string, VuoCompilerType * > vuoTypes
 Cached results of lookUpVuoType(), stored so they can be used on llvmQueue.
 

Member Typedef Documentation

◆ Factory

typedef VuoModuleCompiler *(* VuoModuleCompiler::Factory) (const string &moduleKey, const string &sourcePath, const VuoModuleCompilerSettings &settings)
protected

A method that creates an instance of a subclass of VuoModuleCompiler.

Definition at line 47 of file VuoModuleCompiler.hh.

Constructor & Destructor Documentation

◆ ~VuoModuleCompiler()

VuoModuleCompiler::~VuoModuleCompiler ( void  )
virtual

Definition at line 104 of file VuoModuleCompiler.cc.

◆ VuoModuleCompiler()

VuoModuleCompiler::VuoModuleCompiler ( const string &  moduleKey,
const string &  sourcePath,
const VuoModuleCompilerSettings settings 
)
protected

Constructor to be called by derived classes.

Definition at line 97 of file VuoModuleCompiler.cc.

Member Function Documentation

◆ compile()

virtual VuoModuleCompilerResults VuoModuleCompiler::compile ( dispatch_queue_t  llvmQueue,
VuoCompilerIssues issues 
)
pure virtual

Compiles the source file to LLVM bitcode that can be loaded as a Vuo node class.

The resulting LLVM module and any other generated artifacts are placed in the returned value. If compilation fails, the return value's module field is null and errors are reported in issues.

Implemented in VuoCModuleCompiler, and VuoIsfModuleCompiler.

◆ generateHeader()

string VuoModuleCompiler::generateHeader ( VuoCompilerIssues issues)
virtual

Throws an exception.

Derived classes can override this function to support generating header file contents for a module.

Reimplemented in VuoCModuleCompiler.

Definition at line 111 of file VuoModuleCompiler.cc.

◆ lookUpVuoType()

VuoCompilerType * VuoModuleCompiler::lookUpVuoType ( const string &  typeName)
protected

Adds the VuoCompilerType with the given name to vuoTypes.

This function may be called on any dispatch queue except llvmQueue.

Definition at line 125 of file VuoModuleCompiler.cc.

◆ newModuleCompiler()

VuoModuleCompiler * VuoModuleCompiler::newModuleCompiler ( const string &  type,
const string &  moduleKey,
const string &  sourcePath,
const VuoModuleCompilerSettings settings,
std::function< VuoCompilerType *(const string &)>  getVuoType 
)
static

If a VuoModuleCompiler subclass that is able to handle type and sourcePath is registered, creates an instance of that subclass.

Otherwise, returns null.

Definition at line 71 of file VuoModuleCompiler.cc.

◆ overrideSourceCode()

virtual void VuoModuleCompiler::overrideSourceCode ( const string &  sourceCode,
const string &  sourcePath 
)
pure virtual

When compiling, sourceCode will be used instead of the contents of the source file.

Optionally, sourceFile specifies which file to override when the module has multiple source files.

Implemented in VuoCModuleCompiler, and VuoIsfModuleCompiler.

◆ registerModuleCompiler()

void VuoModuleCompiler::registerModuleCompiler ( string  type,
VuoModuleCompiler::Factory  factory 
)
staticprotected

Registers a method that creates an instance of a subclass of VuoModuleCompiler.

To be called by plugin dylibs.

Definition at line 55 of file VuoModuleCompiler.cc.

Member Data Documentation

◆ moduleKey

string VuoModuleCompiler::moduleKey
protected

The module key of the module to compile.

Definition at line 53 of file VuoModuleCompiler.hh.

◆ settings

VuoModuleCompilerSettings VuoModuleCompiler::settings
protected

Settings to use when compiling the module (specific to the type of module compiler).

Definition at line 55 of file VuoModuleCompiler.hh.

◆ sourcePath

string VuoModuleCompiler::sourcePath
protected

The path of the primary source file to compile.

Definition at line 54 of file VuoModuleCompiler.hh.

◆ vuoTypes

map<string, VuoCompilerType *> VuoModuleCompiler::vuoTypes
protected

Cached results of lookUpVuoType(), stored so they can be used on llvmQueue.

Definition at line 56 of file VuoModuleCompiler.hh.


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