Vuo
1.1.1
|
A specialization of a generic node class.
When the compiler loads the node classes from the module folders, each generic node class (e.g. vuo.data.hold
) is represented by a VuoCompilerNodeClass (not VuoCompilerSpecializedNodeClass) instance.
When the compiler instantiates a specialization of a generic node class to add to a composition, it does this in one of two ways. If the node class is fully specialized (e.g. vuo.data.hold.VuoText
), then it looks up or creates the VuoCompilerSpecializedNodeClass with that implementation (e.g. vuo.data.hold.c
compiled with VuoText
in place of VuoGenericType1
). If the node class is not fully specialized (e.g. vuo.data.hold.VuoGenericType1
), then it creates a unique VuoCompilerSpecializedNodeClass for that node, and that VuoCompilerSpecializedNodeClass does not yet have an implementation.
When the compiler compiles a composition, each not-fully-specialized VuoCompilerSpecializedNodeClass (e.g. vuo.data.hold.VuoGenericType1
) is assigned an implementation, in the form of a "backing" node class (e.g. vuo.data.hold.VuoText
). The backing node class is a fully-specialized VuoCompilerSpecializedNodeClass that's effectively substituted in for the not-fully-specialized node class during the compiling of the composition.
If two nodes in a composition are of the same not-fully-specialized node class, then each node has its own unique VuoCompilerSpecializedNodeClass instance. These two VuoCompilerSpecializedNodeClass instances may have different backing node classes or the same backing node class, depending on what each node is connected to in the composition.
Public Member Functions | |
void | updateBackingNodeClass (VuoNode *nodeToBack, VuoCompiler *compiler) |
Updates the implementation for this VuoCompilerSpecializedNodeClass to be consistent with the backing types of nodeToBack, and updates the VuoCompilerNode of nodeToBack to be consistent with that implementation. | |
bool | isFullySpecialized (void) |
Returns true if this node class has no unspecialized generic types. | |
virtual VuoType * | getOriginalPortType (VuoPortClass *portClass) |
Returns this port's type in the generic node that this specialized node class was derived from. | |
virtual string | getOriginalGenericNodeClassName (void) |
Returns the original node's class name (without any type suffixes). | |
virtual string | getOriginalGenericNodeClassDescription (void) |
Returns the original node's description. | |
virtual VuoNodeSet * | getOriginalGenericNodeSet (void) |
Returns the original node's node set. | |
virtual string | createUnspecializedNodeClassName (set< VuoPortClass * > portClassesToUnspecialize) |
Returns the name for the node class that would result if the given port were changed back to its original type. | |
virtual string | createSpecializedNodeClassNameWithReplacement (string genericTypeName, string specializedTypeName) |
Returns the name for the node class that would result if the given (innermost) specialized type were substituted for the given (innermost) generic type in this node class. | |
Public Member Functions inherited from VuoCompilerNodeClass | |
VuoNode * | newNode (string title="", double x=0, double y=0) |
Creates a substantial base node instance from this node class. | |
VuoNode * | newNode (VuoNode *nodeToCopyMetadataFrom) |
Creates a substantial base node instance with its metadata copied from the existing nodeToCopyMetadataFrom . | |
virtual | ~VuoCompilerNodeClass (void) |
Destructor. | |
Public Member Functions inherited from VuoBaseDetail< VuoNodeClass > | |
VuoBaseDetail (string description, VuoNodeClass *base) | |
Creates a VuoNodeClass detail class. | |
VuoNodeClass * | getBase (void) const |
Returns the VuoNodeClass detail class instance's base class instance. | |
void | setBase (VuoNodeClass *base) |
Sets the VuoNodeClass detail class instance's base class instance. | |
Public Member Functions inherited from VuoCompilerModule | |
virtual | ~VuoCompilerModule (void) |
Destructor. | |
VuoCompilerTargetSet | parseTargetSet (json_object *o, string key) |
Parses the target set value for key in the top level of the JSON object. | |
VuoCompilerTargetSet::MacVersion | parseMacVersion (string version) |
Parses a Mac OS version from a string. | |
VuoCompilerTargetSet | getCompatibleTargets (void) |
Returns the set of targets (operating system versions) with which this module is compatible. | |
Module * | getModule (void) |
Returns this VuoCompilerModule's LLVM module, which other LLVM modules can link to. | |
VuoModule * | getPseudoBase (void) |
Returns the (psuedo) base for this (psuedo) compiler detail class. | |
bool | getPremium (void) |
Returns a boolean indicating whether this module contains premium content. | |
void | setPremium (bool premium) |
Sets the boolean indicating whether this module contains premium content. | |
Static Public Member Functions | |
static VuoNodeClass * | newNodeClass (string nodeClassName, VuoCompiler *compiler, dispatch_queue_t llvmQueue) |
Generates a specalized node class from a generic node class. | |
static VuoCompilerNodeClass * | getNodeClassForNode (VuoCompilerNodeClass *origNodeClass, VuoCompiler *compiler) |
Returns the node class to use for instantiating a node within a composition. | |
static void | replaceGenericTypesWithBacking (string &nodeClassSource) |
Replaces all occurrences of generic type names in the node class source code with a default actual type name. | |
Static Public Member Functions inherited from VuoCompilerNodeClass | |
static VuoNodeClass * | newNodeClass (string nodeClassName, Module *module) |
Creates a new substantial VuoNodeClass from the node class definition in the module. | |
static VuoNodeClass * | newNodeClassWithoutImplementation (VuoNodeClass *baseNodeClass) |
Creates a new implementation-less compiler node class, using the given node class for its base VuoNodeClass. | |
Static Public Member Functions inherited from VuoCompilerModule | |
static VuoCompilerModule * | newModule (string moduleKey, Module *module) |
Instantiates a VuoCompilerModule (or child class) corresponding to the type of VuoCompilerModule defined in the LLVM module. | |
static Function * | declareFunctionInModule (Module *module, Function *function) |
Copies the function's header into the LLVM module, if it's not already there. | |
Protected Member Functions | |
VuoCompilerSpecializedNodeClass (string nodeClassName, Module *module) | |
Creates a specialized node class implementation from an LLVM module, and creates its corresponding base VuoNodeClass . | |
VuoCompilerSpecializedNodeClass (VuoCompilerSpecializedNodeClass *compilerNodeClass) | |
Creates a new compiler node class and creates a new base VuoNodeClass , both from compilerNodeClass . | |
VuoCompilerSpecializedNodeClass (VuoNodeClass *baseNodeClass) | |
Creates a new implementation-less compiler node class, using the given node class for its base VuoNodeClass. | |
Protected Member Functions inherited from VuoCompilerNodeClass | |
VuoCompilerNodeClass (string className, Module *module) | |
Creates a node class implementation from an LLVM module, and creates its corresponding base VuoNodeClass . | |
VuoCompilerNodeClass (VuoCompilerNodeClass *compilerNodeClass) | |
Creates a new compiler node class and creates a new base VuoNodeClass , both from compilerNodeClass. | |
VuoCompilerNodeClass (VuoNodeClass *baseNodeClass) | |
Creates a new implementation-less compiler node class, using the given node class for its base VuoNodeClass. | |
VuoPortClass * | getInputPortClassWithName (string portName) |
Returns the input port class matching the specified portName , if one exists. | |
VuoPortClass * | getOutputPortClassWithName (string portName) |
Returns the output port class matching the specified portName , if one exists. | |
Protected Member Functions inherited from VuoCompilerModule | |
VuoCompilerModule (VuoModule *base, Module *module) | |
Creates a VuoCompilerModule associated with the given LLVM module, as a pseudo compiler detail class of the given VuoModule. | |
string | nameForGlobal (string genericGlobalVarOrFuncName) |
Returns the mangled name for a function or global variable. | |
void | renameGlobalVarsAndFuncs (void) |
Renames the global variables and functions within the LLVM module so that they are unique to this VuoCompilerModule. | |
Protected Attributes | |
map< string, string > | specializedForGenericTypeName |
The type name that replaces each generic type name in the original generic node class. | |
Protected Attributes inherited from VuoCompilerNodeClass | |
map< string, string > | defaultSpecializedForGenericTypeName |
If this node class is generic, use these specialized types when creating an instance. | |
Protected Attributes inherited from VuoCompilerModule | |
struct json_object * | moduleDetails |
This module's metadata, found in the argument to VuoModuleMetadata in the module definition. | |
set< string > | dependencies |
The dependencies found in this module's metadata. | |
Module * | module |
The LLVM module that defines this node class or type. | |
VuoModule * | base |
The (pseudo) base for this (pseudo) compiler detail class. | |
VuoCompilerBitcodeParser * | parser |
The parser of the LLVM module. | |
bool | isPremium |
A boolean indicating whether this module contains premium content. | |
Friends | |
class | TestNodes |
class | TestVuoCompilerNodeClass |
string | getDependencyName (void) |
If the backing node class exists, this function is performed on the backing node class instead of this node class. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from VuoCompilerNodeClass | |
static void | parseGenericTypes (json_object *moduleDetails, map< string, string > &defaultSpecializedForGenericTypeName, map< std::string, vector< std::string > > &compatibleSpecializedForGenericTypeName) |
Parses the "genericTypes" portion of a node class's metadata. | |
|
protected |
Creates a specialized node class implementation from an LLVM module, and creates its corresponding base VuoNodeClass
.
|
protected |
Creates a new compiler node class and creates a new base VuoNodeClass
, both from compilerNodeClass
.
|
protected |
Creates a new implementation-less compiler node class, using the given node class for its base VuoNodeClass.
|
virtual |
Returns the name for the node class that would result if the given (innermost) specialized type were substituted for the given (innermost) generic type in this node class.
Reimplemented in VuoCompilerMakeListNodeClass.
|
virtual |
Returns the name for the node class that would result if the given port were changed back to its original type.
Reimplemented in VuoCompilerMakeListNodeClass.
|
virtual |
If the backing node class exists, this function is performed on the backing node class instead of this node class.
Reimplemented from VuoCompilerModule.
|
static |
Returns the node class to use for instantiating a node within a composition.
vuo.osc.message.get.2.VuoReal.VuoGenericType2
), then a new VuoCompilerSpecializedNodeClass is returned, to be unique to the created node.vuo.osc.message.get.2
), then a new or existing VuoCompilerSpecializedNodeClass is returned, depending on which of the two above cases applies to the node class after it has been specialized with its default types, if any.
|
virtual |
Returns the original node's description.
Reimplemented in VuoCompilerMakeListNodeClass.
|
virtual |
Returns the original node's class name (without any type suffixes).
Reimplemented in VuoCompilerMakeListNodeClass.
|
virtual |
Returns the original node's node set.
Reimplemented in VuoCompilerMakeListNodeClass.
|
virtual |
Returns this port's type in the generic node that this specialized node class was derived from.
Reimplemented in VuoCompilerMakeListNodeClass.
bool VuoCompilerSpecializedNodeClass::isFullySpecialized | ( | void | ) |
Returns true if this node class has no unspecialized generic types.
|
static |
Generates a specalized node class from a generic node class.
nodeClassName | The name of the node class to generate. It should have the format "<generic node class name>.<type>.(...).<type>" (e.g. "vuo.dictionary.make.VuoText.VuoInteger"). |
compiler | The compiler to use for looking up the generic node class and compiling the specialized node class. |
llvmQueue | Synchronizes access to LLVM's global context. |
|
static |
Replaces all occurrences of generic type names in the node class source code with a default actual type name.
void VuoCompilerSpecializedNodeClass::updateBackingNodeClass | ( | VuoNode * | nodeToBack, |
VuoCompiler * | compiler | ||
) |
Updates the implementation for this VuoCompilerSpecializedNodeClass to be consistent with the backing types of nodeToBack, and updates the VuoCompilerNode of nodeToBack to be consistent with that implementation.
|
protected |
The type name that replaces each generic type name in the original generic node class.