|
Jamoma API
0.6.0.a19
|
We build a directory of TTNodes, and you can request a pointer for any TTNode, or add an observer to any TTNode, etc. More...
#include <TTNode.h>
Public Member Functions | |
| TTNode (TTSymbol &aName, TTSymbol &anInstance, TTObject &anObject, TTPtr aContext, TTNodeDirectoryPtr aDirectory) | |
| Constructor. More... | |
| virtual | ~TTNode () |
| Destructor. | |
| TTErr | setNameInstance (TTAddress &aNameInstance, TTSymbol &newInstance, TTBoolean *newInstanceCreated) |
| Set the name and the instance of the node. More... | |
| TTErr | setParent (TTAddress parentAddress, TTBoolean *newParentCreated) |
| Set the parent of the node. More... | |
| TTErr | setChild (TTNodePtr child) |
| Add a node as a child of the node. More... | |
| TTErr | setObject (TTObject anObject=TTObject()) |
| Set the object of the node. More... | |
| TTErr | setContext (TTPtr aContext) |
| Set the context of the node. More... | |
| TTSymbol & | getName () |
| Get the name of the node. More... | |
| TTSymbol & | getInstance () |
| Get the instance of the node. More... | |
| TTNodePtr | getParent () |
| Get a pointer to the parent node of the node. More... | |
| TTErr | getChildren (TTSymbol &name, TTSymbol &instance, TTList &returnedChildren) |
| Get a linklist of children of the node : select them by name and instance (use wilcards to select them all) More... | |
| TTErr | getChildrenName (TTList &returnedChildrenName) |
| Get a linklist of children name. More... | |
| TTErr | getChildrenInstance (TTSymbol &aName, TTList &returnedChildrenInstance) |
| Get a linklist of children instance for a given name. More... | |
| TTObject & | getObject () |
| Get the object binded by this node. More... | |
| TTPtr | getContext () |
| Get a pointer to the context of this node. More... | |
| TTErr | getAddress (TTAddress &returnedAddress, TTAddress from=kTTAdrsEmpty) |
| Get the address of the node. More... | |
| TTErr | generateInstance (TTSymbol &childName, TTSymbol &newInstance) |
| Generate a new instance of a given child. More... | |
We build a directory of TTNodes, and you can request a pointer for any TTNode, or add an observer to any TTNode, etc.
Every time we create a TTNode (or a string passed to something somewhere?) then this gets added to the directory. If a TTNode is specified, such as /degrade~/audio/mute, and we assume degrade~ has been added to the directory but 'audio' hasn't, then 'audio' is added followed by adding 'mute', so that the directory is properly completed.
When a TTNode is requested, the directory is traversed to find the pointer for the TTNode. After the traversal (assuming no wildcards) the pointer is returned and also stored in a hash table so that future requests for that TTNode are faster.
The case of wildcards is handled, because a request is cached (keyed on the request), and the value is a linked list of all of the matches.
| TTNode::TTNode | ( | TTSymbol & | aName, |
| TTSymbol & | anInstance, | ||
| TTObject & | anObject, | ||
| TTPtr | aContext, | ||
| TTNodeDirectoryPtr | aDirectory | ||
| ) |
Constructor.
| aName | the name of the node |
| anInstance | an instance symbol |
| anObject | an object referenced by the node |
| aContext | any pointer to precise the object place in its environnement |
| aDirectory | a pointer to a node directory |
Definition at line 13 of file TTNode.cpp.
Generate a new instance of a given child.
| childName | the name of a child. |
| newInstance | a new instance created (or "" if not) . |
Definition at line 578 of file TTNode.cpp.
References kTTErrGeneric, kTTErrNone, kTTErrValueNotFound, TTHash::lookup(), and TT.
Referenced by setNameInstance(), and TTNodeDirectory::TTNodeCreate().
Here is the call graph for this function:Get the address of the node.
It is computed dynamicaly by asking to all the ancestor of the node
| returnedAddress | a TTAddress with the address is returned in this parameter. |
| from | an address from where to start the returned address in order to have a relative address |
Definition at line 478 of file TTNode.cpp.
References TTSymbol::c_str(), TTAddress::countSeparator(), kTTErrGeneric, kTTErrNone, TTAddress::normalize(), TTValue::resize(), and TTAddress::splitAt().
Referenced by TTNodeDirectory::AliasRemove(), TTNodeDirectory::fillAddressItem(), in_subscribe(), model_subscribe_view(), out_subscribe(), setNameInstance(), TTExplorerDirectoryCallback(), TTNodeDirectory::TTNodeCreate(), TTNodeDirectory::TTNodeRemove(), and ~TTNode().
Here is the call graph for this function:Get a linklist of children of the node : select them by name and instance (use wilcards to select them all)
Definition at line 301 of file TTNode.cpp.
References TTHash::getKeys(), TTHash::getSize(), kTTErrGeneric, kTTErrNone, and TTHash::lookup().
Referenced by TTNodeDirectory::fillAddressItem(), TTNodeDirectory::IsThere(), TTNodeDirectory::LookFor(), TTNodeDirectory::Lookup(), and TTNodeDirectory::TTNodeRemove().
Here is the call graph for this function:Get a linklist of children instance for a given name.
Definition at line 424 of file TTNode.cpp.
References TTValue::append(), TTHash::clear(), TTHash::getKeys(), TTHash::getSize(), kTTErrGeneric, kTTErrNone, and TTHash::lookup().
Here is the call graph for this function:| TTErr TTNode::getChildrenName | ( | TTList & | returnedChildrenName | ) |
Get a linklist of children name.
Definition at line 397 of file TTNode.cpp.
References TTValue::append(), TTHash::getKeys(), TTHash::getSize(), kTTErrGeneric, and kTTErrNone.
Here is the call graph for this function:| TTPtr TTNode::getContext | ( | ) |
Get a pointer to the context of this node.
Definition at line 473 of file TTNode.cpp.
Referenced by model_subscribe(), TTContainerTestObjectAndContext(), and TTNodeDirectory::TTNodeCreate().
| TTSymbol & TTNode::getInstance | ( | ) |
Get the instance of the node.
Definition at line 291 of file TTNode.cpp.
| TTSymbol & TTNode::getName | ( | ) |
Get the name of the node.
Definition at line 286 of file TTNode.cpp.
Referenced by TTContainerTestObjectAndContext(), and TTNodeDirectory::TTNodeCreate().
| TTObject & TTNode::getObject | ( | ) |
Get the object binded by this node.
It return also NULL when the object is not valid
Definition at line 468 of file TTNode.cpp.
Referenced by TTUiInfo::setFreeze(), TTExplorerCompareNodePriority(), TTExplorerDirectoryCallback(), TTInputDirectoryCallback(), TTMapperInputCreationCallback(), TTMapperOutputCreationCallback(), TTNodeDirectory::TTNodeRemove(), TTOutputDirectoryCallback(), TTPresetTestObject(), TTProtocolDirectoryCallback(), TTReceiverDirectoryCallback(), and TTSenderDirectoryCallback().
| TTNodePtr TTNode::getParent | ( | ) |
Get a pointer to the parent node of the node.
Definition at line 296 of file TTNode.cpp.
Referenced by in_subscribe(), model_subscribe(), out_subscribe(), TTContainerTestObjectAndContext(), TTExplorerDirectoryCallback(), TTNodeDirectory::TTNodeCreate(), and TTNodeDirectory::TTNodeRemove().
Add a node as a child of the node.
| child | a TTNodePtr to add as children of the TTNode. |
Definition at line 227 of file TTNode.cpp.
References TTHash::append(), kTTErrGeneric, kTTErrNone, kTTErrValueNotFound, and TTHash::lookup().
Referenced by setNameInstance(), and TTNodeDirectory::TTNodeCreate().
Here is the call graph for this function:Set the context of the node.
| aContext | any pointer usefull to precise a context |
Definition at line 277 of file TTNode.cpp.
References kTTErrNone.
Referenced by TTNodeDirectory::TTNodeCreate().
| TTErr TTNode::setNameInstance | ( | TTAddress & | aNameInstance, |
| TTSymbol & | newInstance, | ||
| TTBoolean * | newInstanceCreated | ||
| ) |
Set the name and the instance of the node.
It maintains the directory and the directory
| aNameInstance | TTAddress name.instance to set |
| newInstance | the returned TTSymbol instance if a new have been created |
| newInstanceCreated | true if a new instance have been created |
Definition at line 101 of file TTNode.cpp.
References TTHash::append(), TTSymbol::c_str(), generateInstance(), getAddress(), TTNodeDirectory::getDirectory(), TTAddress::getInstance(), TTHash::getKeys(), TTAddress::getName(), TTHash::getSize(), kAddressCreated, kAddressDestroyed, kTTErrGeneric, kTTErrNone, kTTErrValueNotFound, TTHash::lookup(), TTNodeDirectory::notifyObservers(), TTHash::remove(), setChild(), and TTValue::size().
Here is the call graph for this function:Set the object of the node.
| anObject | the object to reference |
Definition at line 271 of file TTNode.cpp.
References kTTErrNone.
Set the parent of the node.
This method ensure that the path to the node exist
| parentAddress | The address to check |
| newParentCreated | This parameter will be set to true upon return if a new TTNode was created, or false if one was not created - e.g. because a TTNode already existed with this address and instance name. |
Definition at line 202 of file TTNode.cpp.
References TTNodeDirectory::getDirectory(), kTTErrGeneric, kTTErrNone, kTTErrValueNotFound, TTHash::lookup(), and TTNodeDirectory::TTNodeCreate().
Referenced by TTNodeDirectory::TTNodeCreate().
Here is the call graph for this function: