Jamoma API  0.6.0.a19
TTHash Class Reference

Maintain a collection of TTValue objects indexed by TTSymbol pointers. More...

#include <TTHash.h>

Public Member Functions

TTErr append (const TTSymbol key, const TTValue &value)
 Insert an item into the hash table. More...
 
TTErr lookup (const TTSymbol key, TTValue &value)
 Find the value for the given key. More...
 
TTErr remove (const TTSymbol key)
 Remove an item from the hash table. More...
 
TTErr clear ()
 Remove all items from the hash table. More...
 
TTErr iterate (const TTPtr target, const TTHashIteratorType callback)
 For each item in the hash, run specified function. More...
 
TTErr getKeys (TTValue &hashKeys)
 Get an array of all of the keys for the hash table. More...
 
TTErr getKeysSorted (TTValue &hashKeysSorted, TTBoolean(*comparisonFunction)(TTValue &, TTValue &)=NULL)
 Get an array of all of the keys sorted for the hash table. More...
 
TTUInt32 getSize ()
 Return the number of keys in the hash table. More...
 
TTBoolean isEmpty ()
 Return true if the hash has nothing stored in it. More...
 

Detailed Description

Maintain a collection of TTValue objects indexed by TTSymbol pointers.

The TTValue objects can themselves include TTSymbol pointers, TTObjects, simple values, polymorphic arrays, etc.

TTHash is implemented as a light wrapper class around the STL hash_map templates. While we could inherit from hash_map and then override the appropriate things, there are a few reasons to just contain the hash_map and wrap it.

  • For example, we may later make TTHash inherit from TTObject and want to address it with messages.
  • This approach isolates coders from having to worry about an template craziness
  • This approach offers the possibility, should the need ever arise, to change the underlying implementation away from STL.

Definition at line 36 of file TTHash.h.

Member Function Documentation

TTErr TTHash::clear ( )

Remove all items from the hash table.

Definition at line 117 of file TTHash.cpp.

References kTTErrNone.

Referenced by TTNode::getChildrenInstance(), TTNodeDirectory::init(), TTExplorerDirectoryCallback(), and TTNode::~TTNode().

TTErr TTHash::getKeysSorted ( TTValue hashKeysSorted,
TTBoolean(*)(TTValue &, TTValue &)  comparisonFunction = NULL 
)

Get an array of all of the keys sorted for the hash table.

Definition at line 148 of file TTHash.cpp.

References TTValue::append(), TTValue::clear(), and kTTErrNone.

+ Here is the call graph for this function:

TTUInt32 TTHash::getSize ( )
TTBoolean TTHash::isEmpty ( )

Return true if the hash has nothing stored in it.

Definition at line 205 of file TTHash.cpp.

Referenced by TTNodeDirectory::notifyObservers(), wrappedModularClass_anything(), and wrappedModularClass_attrSet().

TTErr TTHash::iterate ( const TTPtr  target,
const TTHashIteratorType  callback 
)

For each item in the hash, run specified function.

Definition at line 188 of file TTHash.cpp.

References kTTErrNone.

TTErr TTHash::lookup ( const TTSymbol  key,
TTValue value 
)

Find the value for the given key.

Definition at line 76 of file TTHash.cpp.

References TTSymbol::rawpointer().

Referenced by TTNodeDirectory::addObserverForNotifications(), TTProtocol::ApplicationRegister(), TTProtocol::ApplicationRename(), TTProtocol::ApplicationUnregister(), TTApplication::convertAppNameToTTName(), TTApplication::convertTTNameToAppName(), TTEnvironment::createInstance(), TTApplicationManager::findApplication(), TTObjectBase::findAttribute(), TTObjectBase::findMessage(), TTApplicationManager::findProtocol(), TTNode::generateInstance(), TTNodeDirectory::getAlias(), TTProtocol::getApplicationParameters(), TTApplicationManager::getApplicationProtocolNames(), TTNode::getChildren(), TTNode::getChildrenInstance(), TTEnvironment::getClassNamesWithTags(), getSelectedObject(), TTEnvironment::isClassRegistered(), TTProtocol::isRegistered(), MaxAudioGraphWrappedClassOptions::lookup(), model_preset_doedit(), model_preset_doread(), model_preset_doread_again(), model_preset_dowrite(), model_preset_dowrite_again(), model_preset_edit(), model_reference_dowrite(), model_signal_amenities(), model_signal_return_audio_bypass(), model_signal_return_audio_gain(), model_signal_return_audio_mix(), model_signal_return_audio_mute(), model_signal_return_data_active(), model_signal_return_data_bypass(), TTNodeDirectory::notifyObservers(), receive_address(), TTObjectBase::registerAttributeProperty(), TTEnvironment::registerClass(), TTObjectBase::registerMessageProperty(), TTNodeDirectory::removeObserverForNotifications(), TTNodeDirectory::replaceAlias(), send_address(), TTProtocol::setApplicationParameters(), TTNode::setChild(), TTDataspace::setInputUnit(), TTNode::setNameInstance(), TTDataspace::setOutputUnit(), TTNode::setParent(), TTApplicationManagerAddApplicationObserver(), TTApplicationManagerRemoveApplicationObserver(), TTModularSelectionLookup(), TTNodeDirectory::TTNodeCreate(), TTNode::~TTNode(), TTObjectBase::~TTObjectBase(), and TTProtocol::~TTProtocol().

+ Here is the call graph for this function:


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