63 IndexT Add(
const KEYTYPE& key,
const VALUETYPE& value);
93 template<
class RETURNTYPE> RETURNTYPE
KeysAs()
const;
95 template<
class RETURNTYPE> RETURNTYPE
ValuesAs()
const;
114template<
class KEYTYPE,
class VALUETYPE>
124template<
class KEYTYPE,
class VALUETYPE>
129 #if NEBULA_BOUNDSCHECKS
137template<
class KEYTYPE,
class VALUETYPE>
142#if NEBULA_BOUNDSCHECKS
150template<
class KEYTYPE,
class VALUETYPE>
154 #if NEBULA_BOUNDSCHECKS
164template<
class KEYTYPE,
class VALUETYPE>
168#if NEBULA_BOUNDSCHECKS
178template<
class KEYTYPE,
class VALUETYPE>
182 #if NEBULA_BOUNDSCHECKS
191template<
class KEYTYPE,
class VALUETYPE>
201template<
class KEYTYPE,
class VALUETYPE>
211template<
class KEYTYPE,
class VALUETYPE>
221template<
class KEYTYPE,
class VALUETYPE>
225 #if NEBULA_BOUNDSCHECKS
234template<
class KEYTYPE,
class VALUETYPE>
238 #if NEBULA_BOUNDSCHECKS
248template<
class KEYTYPE,
class VALUETYPE>
265template<
class KEYTYPE,
class VALUETYPE>
283template<
class KEYTYPE,
class VALUETYPE>
287#if NEBULA_BOUNDSCHECKS
305template<
class KEYTYPE,
class VALUETYPE>
323template<
class KEYTYPE,
class VALUETYPE>
327 #if NEBULA_BOUNDSCHECKS
331 #if NEBULA_BOUNDSCHECKS
340template<
class KEYTYPE,
class VALUETYPE>
344 #if NEBULA_BOUNDSCHECKS
353template<
class KEYTYPE,
class VALUETYPE>
357 #if NEBULA_BOUNDSCHECKS
360 return this->
keyValuePairs.template BinarySearchIndex<KEYTYPE>(key);
366template<
class KEYTYPE,
class VALUETYPE>
370 #if NEBULA_BOUNDSCHECKS
379template<
class KEYTYPE,
class VALUETYPE>
383#if NEBULA_BOUNDSCHECKS
386 index = this->
keyValuePairs.template BinarySearchIndex<KEYTYPE>(key);
393template<
class KEYTYPE,
class VALUETYPE>
397 #if NEBULA_BOUNDSCHECKS
406template<
class KEYTYPE,
class VALUETYPE>
410 #if NEBULA_BOUNDSCHECKS
419template<
class KEYTYPE,
class VALUETYPE>
420inline const VALUETYPE&
423 #if NEBULA_BOUNDSCHECKS
432template<
class KEYTYPE,
class VALUETYPE>
436 #if NEBULA_BOUNDSCHECKS
445template<
class KEYTYPE,
class VALUETYPE>
449 int keyValuePairIndex = this->
FindIndex(key);
450 #if NEBULA_BOUNDSCHECKS
459template<
class KEYTYPE,
class VALUETYPE>
460inline const VALUETYPE&
463 int keyValuePairIndex = this->
FindIndex(key);
464 #if NEBULA_BOUNDSCHECKS
473template<
class KEYTYPE,
class VALUETYPE>
474template<
class RETURNTYPE>
478 #if NEBULA_BOUNDSCHECKS
481 RETURNTYPE result(this->
Size(),this->
Size());
493template<
class KEYTYPE,
class VALUETYPE>
503template<
class KEYTYPE,
class VALUETYPE>
504template<
class RETURNTYPE>
508 #if NEBULA_BOUNDSCHECKS
511 RETURNTYPE result(this->
Size(),this->
Size());
523template<
class KEYTYPE,
class VALUETYPE>
533template<
class KEYTYPE,
class VALUETYPE>
542template<
class KEYTYPE,
class VALUETYPE>
551template<
class KEYTYPE,
class VALUETYPE>
560template<
class KEYTYPE,
class VALUETYPE>
564 this->
Add(key, value);
Nebula's dynamic array class.
Definition array.h:60
void BeginBulkAdd()
begin a bulk insert (array will be sorted at End)
Definition dictionary.h:223
void operator=(Dictionary< KEYTYPE, VALUETYPE > &&rhs) noexcept
move operator
Definition dictionary.h:166
Dictionary(const Dictionary< KEYTYPE, VALUETYPE > &rhs)
copy constructor
Definition dictionary.h:125
void Reserve(SizeT numElements)
reserve space (useful if number of elements is known beforehand)
Definition dictionary.h:213
bool Contains(const KEYTYPE &key) const
return true if key exists in the array
Definition dictionary.h:368
void Clear()
clear the dictionary
Definition dictionary.h:180
SizeT Size() const
return number of key/value pairs in the dictionary
Definition dictionary.h:193
KeyValuePair< KEYTYPE, VALUETYPE > * end() const
Definition dictionary.h:544
const KEYTYPE & KeyAtIndex(IndexT index) const
get a key at given index
Definition dictionary.h:395
IndexT FindIndex(const KEYTYPE &key) const
find index of key/value pair (InvalidIndex if doesn't exist)
Definition dictionary.h:355
Array< KEYTYPE > KeysAsArray() const
get all keys as an Util::Array
Definition dictionary.h:525
Dictionary(Dictionary< KEYTYPE, VALUETYPE > &&rhs) noexcept
move constructor
Definition dictionary.h:138
const VALUETYPE & ValueAtIndex(IndexT index) const
get a value at given index
Definition dictionary.h:421
IndexT Add(const KeyValuePair< KEYTYPE, VALUETYPE > &kvp)
add a key/value pair
Definition dictionary.h:267
void clear()
Definition dictionary.h:553
void EraseAtIndex(IndexT index)
erase a key at index
Definition dictionary.h:342
KeyValuePair< KEYTYPE, VALUETYPE > & KeyValuePairAtIndex(IndexT index) const
get key/value pair at index
Definition dictionary.h:434
const VALUETYPE & operator[](const KEYTYPE &key) const
read-only [] operator
Definition dictionary.h:461
RETURNTYPE ValuesAs() const
get all keys as (typically) an array
Definition dictionary.h:476
bool IsEmpty() const
return true if empty
Definition dictionary.h:203
VALUETYPE & ValueAtIndex(IndexT index)
access to value at given index
Definition dictionary.h:408
RETURNTYPE KeysAs() const
get all keys as (typically) an array
Definition dictionary.h:506
Array< VALUETYPE > ValuesAsArray() const
get all keys as an Util::Array
Definition dictionary.h:495
void emplace(KEYTYPE &&key, VALUETYPE &&value)
Definition dictionary.h:562
void Erase(const KEYTYPE &key)
erase a key and its associated value
Definition dictionary.h:325
VALUETYPE & operator[](const KEYTYPE &key)
read/write [] operator
Definition dictionary.h:447
bool Contains(const KEYTYPE &key, IndexT &index) const
return true if key exists in the array, and saves index
Definition dictionary.h:381
bool inBulkInsert
Definition dictionary.h:108
void Merge(const Dictionary< KEYTYPE, VALUETYPE > &rhs)
merge two dictionaries
Definition dictionary.h:250
IndexT Add(const KEYTYPE &key, const VALUETYPE &value)
add a key and associated value
Definition dictionary.h:285
KeyValuePair< KEYTYPE, VALUETYPE > * begin() const
functions for stl like behaviour
Definition dictionary.h:535
void EndBulkAdd()
end a bulk insert (this will sort the internal array)
Definition dictionary.h:236
void operator=(const Dictionary< KEYTYPE, VALUETYPE > &rhs)
assignment operator
Definition dictionary.h:152
Array< KeyValuePair< Util::StringAtom, CoreGraphics::BufferId > > keyValuePairs
Definition dictionary.h:107
Dictionary()
default constructor
Definition dictionary.h:115
VALUETYPE & Emplace(const KEYTYPE &key)
creates a new entry of VALUETYPE if key does not exist, or returns the existing element
Definition dictionary.h:307
void SortIfDirty() const
make sure the key value pair array is sorted
Key/Value pair objects are used by most assiociative container classes, like Dictionary or HashTable.
Definition keyvaluepair.h:19
#define n_assert(exp)
Definition debug.h:50
A pinned array is an array which manages its own virtual memory.
Definition String.cs:6
static const int InvalidIndex
Definition types.h:54
int SizeT
Definition types.h:49
int IndexT
Definition types.h:48