Handles loading of node classes and types.
When modules are loaded on launch, and when they are installed, uninstalled, or modified while the editor is running, this class receives notifications from the compiler and updates the UI and cached data.
Definition at line 30 of file VuoModuleManager.hh.
Public Types | |
typedef void(^ | CallbackType) (void) |
Invoked when a node class is loaded. | |
Signals | |
void | loadedModulesAndReadyToUpdate (const vector< string > &nodeClassesToRemove, const vector< VuoCompilerNodeClass * > &nodeClassesToAdd, const vector< string > &typesToRemove, const vector< VuoCompilerType * > &typesToAdd, const vector< string > &librariesToRemove, const ModulesModifiedSet &modulesModified, VuoCompilerIssues *issues) |
Used for scheduling UI changes on the main thread. | |
Public Member Functions | |
VuoModuleManager (VuoCompiler *compiler) | |
Constructs a VuoModuleManager that is ready to receive notifications when compiler loads/unloads modules. | |
virtual | ~VuoModuleManager (void) |
Destroys this object after waiting for all pending work to complete. | |
void | setComposition (VuoEditorComposition *composition) |
Sets the composition to update when modules are loaded/unloaded. | |
void | setCodeWindow (VuoCodeWindow *codeWindow) |
Sets the code window to update when the code window's node class fails to load. | |
void | setNodeLibrary (VuoNodeLibrary *nodeLibrary) |
Sets the node library to update when modules are loaded/unloaded. | |
VuoNodeLibrary * | getNodeLibrary (void) |
Returns the node library currently being updated when modules are loaded/unloaded. | |
void | updateWithAlreadyLoadedModules (void) |
Populates this class and the UI with existing modules, loaded before this VuoModuleManager was created. | |
void | doNextTimeNodeClassIsLoaded (const string &nodeClassName, CallbackType callback) |
Schedules the block callback to be called the next time this module manager is notified that a node class with the given name has been added or modified. | |
void | doEveryTimeNodeClassIsLoaded (const string &nodeClassName, CallbackType callback) |
Schedules the block callback to be called every time this module manager is notified that a node class with the given name has been added or modified. | |
void | cancelCallbackForNodeClass (const string &nodeClassName) |
Cancels the callback previously scheduled by doNextTimeNodeClassIsLoaded or doEveryTimeNodeClassIsLoaded. | |
map< string, VuoCompilerType * > | getLoadedSingletonTypes (bool limitToSpecializationTargets) |
Returns all singleton (non-compound) types that have been loaded and not subsequently unloaded. | |
map< string, VuoCompilerType * > | getLoadedGenericCompoundTypes (void) |
Returns all unspecialized generic compound types that have been unloaded and subsequently unloaded. | |
set< string > | getKnownListTypeNames (bool limitToSpecializationTargets) |
Returns the names of all specializations of the VuoList compound type that could be created from the singleton types that have been loaded. | |
set< string > | getKnownNodeSets (void) |
Returns the node sets from which at least one node class or type has been loaded (though is not necessarily still loaded). | |
string | getNodeSetForType (const string &typeName) |
Returns the name of the node set to which typeName belongs for the purpose of display in the editor (not necessarily its actual node set), or an empty string if it's considered a core type not belonging to any node set. | |
vector< string > | getCompatibleTypecastClasses (const string &fromTypeName, VuoType *fromType, const string &toTypeName, VuoType *toType) |
Returns the type-converter node classes that can convert from the given from-type to the given to-type. | |
set< string > | findInstancesOfNodeClass (const string &sourcePath) |
Returns the fully qualified node identifier (i.e., prefixed by composition identifier) of each instance of the given node class that appears at any level in this module manager's composition. | |
void | loadedModules (const map< string, VuoCompilerModule * > &modulesAdded, const map< string, pair< VuoCompilerModule *, VuoCompilerModule * > > &modulesModified, const map< string, VuoCompilerModule * > &modulesRemoved, VuoCompilerIssues *issues) |
Compiler delegate method, called when modules are loaded/unloaded. | |
typedef void(^ VuoModuleManager::CallbackType) (void) |
Invoked when a node class is loaded.
Definition at line 35 of file VuoModuleManager.hh.
VuoModuleManager::VuoModuleManager | ( | VuoCompiler * | compiler | ) |
Constructs a VuoModuleManager that is ready to receive notifications when compiler loads/unloads modules.
This object becomes responsible for deleting compiler.
Definition at line 47 of file VuoModuleManager.cc.
|
virtual |
Destroys this object after waiting for all pending work to complete.
Definition at line 68 of file VuoModuleManager.cc.
void VuoModuleManager::cancelCallbackForNodeClass | ( | const string & | nodeClassName | ) |
Cancels the callback previously scheduled by doNextTimeNodeClassIsLoaded or doEveryTimeNodeClassIsLoaded.
Definition at line 312 of file VuoModuleManager.cc.
void VuoModuleManager::doEveryTimeNodeClassIsLoaded | ( | const string & | nodeClassName, |
CallbackType | callback | ||
) |
Schedules the block callback to be called every time this module manager is notified that a node class with the given name has been added or modified.
Definition at line 301 of file VuoModuleManager.cc.
void VuoModuleManager::doNextTimeNodeClassIsLoaded | ( | const string & | nodeClassName, |
CallbackType | callback | ||
) |
Schedules the block callback to be called the next time this module manager is notified that a node class with the given name has been added or modified.
Definition at line 289 of file VuoModuleManager.cc.
set< string > VuoModuleManager::findInstancesOfNodeClass | ( | const string & | sourcePath | ) |
Returns the fully qualified node identifier (i.e., prefixed by composition identifier) of each instance of the given node class that appears at any level in this module manager's composition.
sourcePath | The path of the node class's source code. If a node class with the same class name is installed at multiple locations accessible to the composition (e.g., user modules and composition-local modules), this function only returns instances of the node class if the composition actually uses the implementation at sourcePath. |
Definition at line 331 of file VuoModuleManager.cc.
vector< string > VuoModuleManager::getCompatibleTypecastClasses | ( | const string & | fromTypeName, |
VuoType * | fromType, | ||
const string & | toTypeName, | ||
VuoType * | toType | ||
) |
Returns the type-converter node classes that can convert from the given from-type to the given to-type.
If the from-type and to-type are both concrete types (as opposed to unspecialized generic types), then only fromTypeName and toTypeName need to be passed. This function will return all type-converters where the input port type is or can be specialized to fromTypeName and the output port type is or can be specialized to toTypeName.
If the from-type is an unspecialized generic type, then fromType must additionally be provided. This function will return all type-converters where the input port type is generic and compatible with fromType. Same idea if the to-type is an unspecialized generic type.
Returns true if converterInOut matches (or can be specialized to) fromType + toType.
If so, and if the converter requires specialization, outputs the specialized type name in outSpecializations
. (Currently all type-converter node classes have at most one generic type, and that seems unlikely to change.)
Definition at line 215 of file VuoModuleManager.cc.
set< string > VuoModuleManager::getKnownListTypeNames | ( | bool | limitToSpecializationTargets | ) |
Returns the names of all specializations of the VuoList
compound type that could be created from the singleton types that have been loaded.
(The returned list types have not necessarily been loaded yet.)
Definition at line 161 of file VuoModuleManager.cc.
set< string > VuoModuleManager::getKnownNodeSets | ( | void | ) |
Returns the node sets from which at least one node class or type has been loaded (though is not necessarily still loaded).
Definition at line 176 of file VuoModuleManager.cc.
map< string, VuoCompilerType * > VuoModuleManager::getLoadedGenericCompoundTypes | ( | void | ) |
Returns all unspecialized generic compound types that have been unloaded and subsequently unloaded.
Definition at line 152 of file VuoModuleManager.cc.
map< string, VuoCompilerType * > VuoModuleManager::getLoadedSingletonTypes | ( | bool | limitToSpecializationTargets | ) |
Returns all singleton (non-compound) types that have been loaded and not subsequently unloaded.
This excludes the generic VuoList
type, which is instead returned by VuoModuleManager::getLoadedGenericCompoundTypes(). It does include the VuoDictionary_*_*
types.
limitToSpecializationTargets | If true, excludes the few types to which a generic type cannot be specialized due to implementation details. |
Definition at line 133 of file VuoModuleManager.cc.
VuoNodeLibrary * VuoModuleManager::getNodeLibrary | ( | void | ) |
Returns the node library currently being updated when modules are loaded/unloaded.
May be null if the node library is detached.
Definition at line 119 of file VuoModuleManager.cc.
string VuoModuleManager::getNodeSetForType | ( | const string & | typeName | ) |
Returns the name of the node set to which typeName belongs for the purpose of display in the editor (not necessarily its actual node set), or an empty string if it's considered a core type not belonging to any node set.
Definition at line 186 of file VuoModuleManager.cc.
|
virtual |
Compiler delegate method, called when modules are loaded/unloaded.
Implements VuoCompilerDelegate.
Definition at line 380 of file VuoModuleManager.cc.
|
signal |
Used for scheduling UI changes on the main thread.
void VuoModuleManager::setCodeWindow | ( | VuoCodeWindow * | codeWindow | ) |
Sets the code window to update when the code window's node class fails to load.
Definition at line 96 of file VuoModuleManager.cc.
void VuoModuleManager::setComposition | ( | VuoEditorComposition * | composition | ) |
Sets the composition to update when modules are loaded/unloaded.
Definition at line 88 of file VuoModuleManager.cc.
void VuoModuleManager::setNodeLibrary | ( | VuoNodeLibrary * | nodeLibrary | ) |
Sets the node library to update when modules are loaded/unloaded.
Definition at line 104 of file VuoModuleManager.cc.
void VuoModuleManager::updateWithAlreadyLoadedModules | ( | void | ) |
Populates this class and the UI with existing modules, loaded before this VuoModuleManager was created.
Definition at line 462 of file VuoModuleManager.cc.