18 #ifndef __TT_DICTIONARY_H__
19 #define __TT_DICTIONARY_H__
22 #include "TTSymbolCache.h"
64 create(aDictionaryName, kTTSym_none, aDictionaryWasCreated);
70 create(aDictionaryName, kTTSym_none, dictionaryCreated);
82 if (aDictionaryName ==
"")
85 mDictionaryInstance = gTTDictionaryTable[aDictionaryName.
rawpointer()];
86 if (!mDictionaryInstance) {
88 gTTDictionaryTable[aDictionaryName.
rawpointer()] = mDictionaryInstance;
89 setSchema(aSchemaName);
90 aDictionaryWasCreated =
true;
93 aDictionaryWasCreated =
false;
95 mName = aDictionaryName;
96 mDictionaryInstance->mReferenceCount++;
102 mName =
TTSymbol(do_not_use_this_unless_your_name_is_ttelement_and_you_are_a_destructor->mValue.dictionary);
103 mDictionaryInstance = gTTDictionaryTable[mName.
rawpointer()];
111 mName = aSourceDictionary.mName;
112 mDictionaryInstance = aSourceDictionary.mDictionaryInstance;
113 mDictionaryInstance->mReferenceCount++;
121 mDictionaryInstance->mReferenceCount--;
122 if (mDictionaryInstance->mReferenceCount == 0) {
124 delete mDictionaryInstance;
125 mDictionaryInstance = NULL;
146 TTErr registerObserverForNotifications(
const TTObject& anObservingObject);
156 TTErr unregisterObserverForNotifications(
const TTObject& anObservingObject);
163 (*mDictionaryInstance) = (*aSource.mDictionaryInstance);
174 return mDictionaryInstance->
setSchema(aSchemaName);
192 return mDictionaryInstance->
setValue(aNewValue);
204 return mDictionaryInstance->
getValue(aReturnedValue);
214 return mDictionaryInstance->
append(aKey, aValue);
223 return mDictionaryInstance->
lookup(aKey, aValue);
233 return mDictionaryInstance->
remove(aKey);
242 return mDictionaryInstance->
clear();
252 return mDictionaryInstance->
getKeys(aSetOfKeys);
261 return mDictionaryInstance->
getSize();
270 return mDictionaryInstance->
isEmpty();
283 #endif // __TT_DICTIONARY_H__
TTErr setSchema(const TTSymbol schemaName)
TODO: Add documentation schemaName TODO: Add documentation.
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
A type that contains a key and a value.
virtual ~TTDictionary()
Destructor.
TTPtrSizedInt size()
Return the number of keys in the hash table.
TTErr append(const TTSymbol aKey, const TTValue aValue)
Insert an item into the hash table.
TTSymbol name() const
Return the name associated with the dictionary.
TTErr setValue(const TTValue &newValue)
TODO: Add documentation.
Create and use Jamoma object instances.
TTErr clear()
Remove all items from the hash table.
TTErr getKeys(TTValue &aSetOfKeys)
Get an array of all of the keys for the hash table.
Base class for all first-class Jamoma objects.
const TTSymbol getSchema() const
TODO: Add documentation.
TTErr getValue(T &aReturnedValue) const
Get the dictionary's primary value.
static TTSymbol random()
Generate a pseudo-random symbol.
A type that represents the key as a C-String and the value as a pointer to the matching TTSymbol obje...
TTErr clear()
Remove all items from the hash table.
TTPtr rawpointer() const
Get the value of the raw pointer into the symbol table.
TTBoolean isEmpty()
Return true if the hash has nothing stored in it.
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
const TTSymbol getSchema() const
TODO: Add documentation.
TTDictionary(TTSymbol aDictionaryName, TTBoolean &aDictionaryWasCreated)
Constructor.
TTDictionary(const TTDictionary &aSourceDictionary)
Copy Constructor.
TTUInt32 getSize()
Return the number of keys in the hash table.
TTErr lookup(const TTSymbol key, TTValue &value) const
Find the value for the given key.
Individual items found in a TTValue.
TTBoolean empty()
Return true if the hash has nothing stored in it.
TTErr setSchema(const TTSymbol aSchemaName)
TODO: Add documentation schemaName TODO: Add documentation.
TTErr setValue(const TTValue aNewValue)
TODO: Add documentation.
long TTPtrSizedInt
An integer that is the same size as a pointer.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
TTErr append(const TTSymbol key, const TTValue &value)
Insert an item into the hash table.
TTErr lookup(const TTSymbol aKey, TTValue &aValue) const
Find the value for the given key.
std::unordered_map< TTPtr, TTDictionaryBase * > TTDictionaryTable
Map names to internal dictionary instances.
TTErr remove(const TTSymbol key)
Remove an item from the hash table.
TTDictionary * TTDictionaryPtr
[doxygenAppendixC_typedefExample]
[doxygenAppendixC_copyExample]
Foundation Dictionary Class.
TTErr getValue(TTValue &returnedValue) const
TODO: Add documentation.
TTErr getKeys(TTValue &hashKeys)
Get an array of all of the keys for the hash table.