Cache of nodes' graphviz identifiers and ports' static identifiers, with thread-safe access.
Definition at line 21 of file VuoNodeAndPortIdentifierCache.hh.
Public Member Functions | |
void | addCompositionComponentsToCache (VuoComposition *composition) |
Caches the identifiers for all nodes and ports (including published ports) in composition. More... | |
void | addNodeToCache (VuoNode *node) |
Caches the identifiers for node and its ports. More... | |
void | addPublishedPortToCache (VuoPublishedPort *publishedPort) |
Caches the identifier for publishedPort. More... | |
void | clearCache (void) |
Removes all items from the cache. More... | |
bool | doForNodeWithIdentifier (const string &identifier, std::function< void(VuoNode *)> callback) |
Thread-safely looks up the node with cached identifier and calls callback on it. More... | |
bool | doForPortWithIdentifier (const string &identifier, std::function< void(VuoPort *)> callback) |
Thread-safely looks up the port with cached identifier and calls callback on it. More... | |
string | getIdentifierForPort (VuoPort *port) |
Returns the cached identifier for port, or an empty string if not found. More... | |
void VuoNodeAndPortIdentifierCache::addCompositionComponentsToCache | ( | VuoComposition * | composition | ) |
Caches the identifiers for all nodes and ports (including published ports) in composition.
Definition at line 18 of file VuoNodeAndPortIdentifierCache.cc.
void VuoNodeAndPortIdentifierCache::addNodeToCache | ( | VuoNode * | node | ) |
Caches the identifiers for node and its ports.
Definition at line 35 of file VuoNodeAndPortIdentifierCache.cc.
void VuoNodeAndPortIdentifierCache::addPublishedPortToCache | ( | VuoPublishedPort * | publishedPort | ) |
Caches the identifier for publishedPort.
Definition at line 60 of file VuoNodeAndPortIdentifierCache.cc.
void VuoNodeAndPortIdentifierCache::clearCache | ( | void | ) |
Removes all items from the cache.
Definition at line 80 of file VuoNodeAndPortIdentifierCache.cc.
bool VuoNodeAndPortIdentifierCache::doForNodeWithIdentifier | ( | const string & | identifier, |
std::function< void(VuoNode *)> | callback | ||
) |
Thread-safely looks up the node with cached identifier and calls callback on it.
Returns true if the node is found, false otherwise. If the node is not found, callback is not called.
When possible, it's safest to avoid using the VuoNode
object (or anything attached to it, such as its VuoRendererNode
) outside of callback. If you do allow the node to leak out, make sure the node is not going to be removed from the composition while you're using it.
callback should not put synchronous calls on VuoEditorComposition::activePopoversQueue
(to avoid deadlock).
Definition at line 100 of file VuoNodeAndPortIdentifierCache.cc.
bool VuoNodeAndPortIdentifierCache::doForPortWithIdentifier | ( | const string & | identifier, |
std::function< void(VuoPort *)> | callback | ||
) |
Thread-safely looks up the port with cached identifier and calls callback on it.
Returns true if the port is found, false otherwise. If the port is not found, callback is not called.
When possible, it's safest to avoid using the VuoPort
object (or anything attached to it, such as its VuoRendererPort
) outside of callback. If you do allow the port to leak out, make sure the port is not going to be removed from the composition while you're using it.
callback should not put synchronous calls on VuoEditorComposition::activePopoversQueue
(to avoid deadlock).
Definition at line 125 of file VuoNodeAndPortIdentifierCache.cc.
string VuoNodeAndPortIdentifierCache::getIdentifierForPort | ( | VuoPort * | port | ) |
Returns the cached identifier for port, or an empty string if not found.
Definition at line 142 of file VuoNodeAndPortIdentifierCache.cc.