A generic map template base class. More...
#include "murl_map_base.h"
Inherited by Murl::Map< Murl::String, Signature * >, Murl::Map< UInt32, UniformEntry * >, Murl::Map< UInt32, NativeOutline * >, Murl::Map< Murl::IUrlRequest *, Foundation::UrlRequest * >, Murl::Map< UInt32, SInt32 >, Murl::Map< UInt32, GraphNodeHandleInstance * >, Murl::Map< IFrameBuffer *, FrameBufferItem * >, Murl::Map< UInt32, NativeRectangle * >, Murl::Map< String, CollectionCreator * >, Murl::Map< String, ConstData >, Murl::Map< UInt64, Contact * >, Murl::Map< const UInt8 *, UInt64 >, Murl::Map< Murl::Graph::IBone *, Murl::Graph::IBone * >, Murl::Map< Murl::String, UInt32 >, Murl::Map< Murl::String, Murl::Resource::IPackageFactory * >, Murl::Map< Murl::String, RawKeyCode >, Murl::Map< SInt32, UrlRequest * >, Murl::Map< Murl::String, const Murl::AttributeInfo::Item * >, Murl::Map< Murl::String, const ClassInfoType * >, Murl::Map< UInt32, AttributeEntry * >, Murl::Map< const IPackage *, ConstData >, Murl::Map< Murl::String, jobject >, Murl::Map< UInt32, UInt32 >, Murl::Map< Murl::String, Murl::AutoPointer >, Murl::Map< UInt32, VaryingEntry * >, Murl::Map< Murl::String, Movie * >, Murl::Map< Murl::String, GlUniformInfo >, Murl::Map< UInt32, ID3D11InputLayout * >, Murl::Map< SInt32, UInt32 >, Murl::Map< UInt32, Murl::AutoPointer >, Murl::Map< const Murl::Graph::IBoundingVolume *, ShadowItem * >, Murl::Map< UInt32, TouchState >, Murl::Map< UInt32, TextureEntry * >, Murl::Map< Murl::String, const Murl::PropertyInfo::Item * >, Murl::Map< const void *, const ClassRTTI * >, Murl::Map< Murl::String, IImageDecompressor * >, Murl::Map< Murl::IEMail *, EMail * >, Murl::Map< Murl::String, SharedPointer< Socket > >, Murl::Map< Murl::String, CountTime >, Murl::Map< Murl::String, SInt32 >, Murl::Map< ILight *, LightStageItem * >, Murl::Map< UInt32, Renderbuffer * >, Murl::Map< Murl::String, IImageEncoder * >, Murl::Map< String, IVideoSurface * >, Murl::Map< const UInt8 *, FileHandle >, Murl::Map< Murl::IUrlRequest *, Platform::Foundation::UrlRequest * >, Murl::Map< Murl::IUrlRequest *, UrlRequest * >, Murl::Map< UInt32, RawKeyCode >, Murl::Map< String, INamespace * >, Murl::Map< Murl::String, Package * >, Murl::Map< UInt32, const Murl::AttributeInfo::Item * >, Murl::Map< UInt32, Signature * >, Murl::Map< Murl::Video::IProgram *, UInt32 >, Murl::Map< Murl::String, EvaluatorExpression * >, Murl::Map< UInt32, const Murl::PropertyInfo::Item * >, Murl::Map< Murl::String, Attribute * >, Murl::Map< IView *, ViewItem * >, Murl::Map< Murl::String, IImageCompressor * >, Murl::Map< UInt64, Real >, Murl::Map< Murl::String, Murl::ICustomControlable * >, Murl::Map< UInt32, Murl::String >, Murl::Map< Murl::String, SKProduct * >, Murl::Map< UInt32, ConstantBufferEntry * >, Murl::Map< Murl::String, Murl::String >, Murl::Map< Murl::String, Murl::Resource::IObjectFactory * >, Murl::Map< String, StringArray >, Murl::Map< Murl::String, IImageDecoder * >, Murl::Map< Murl::String, BinaryString * >, Murl::Map< UInt64, DrawableItem * >, Murl::Map< IEnums::AttributeItem, Attribute * >, Murl::Map< UInt32, Attribute * >, Murl::Map< Murl::String, Murl::Resource::ICollectionFactory * >, Murl::Map< String, INode * >, Murl::Map< Murl::String, GlAttributeInfo >, Murl::Map< String, PackageCreator * >, Murl::Map< String, ObjectCreator * >, Murl::Map< String, Text * >, Murl::Map< Murl::Graph::IHandleInstance *, InstanceItem * >, Murl::Map< ICamera *, CameraItem * >, Murl::Map< Murl::Video::IProgram *, ProgramItem * >, Murl::Map< UInt32, ConstantEntry * >, Murl::Map< const IObject *, ConstData >, Murl::Map< Murl::String, SystemFontDescriptor * >, Murl::Map< Murl::String, const Murl::Enum< SInt32 > * >, Murl::ObjectMap< Murl::String, EvaluatorVariable >, Murl::ObjectMap< Murl::String, Platform::AppStoreProduct >, Murl::ObjectMap< StateType, IStateMethods, StdHash< StateType > >, Murl::ObjectMap< UInt32, RenderbuffersBySize >, Murl::ObjectMap< String, ObjectPair< IGrid > >, Murl::ObjectMap< String, ObjectPair< IArchive > >, Murl::ObjectMap< String, ObjectPair< IFont > >, Murl::ObjectMap< Murl::Video::IFrameBuffer *, FrameBufferAttachment >, Murl::ObjectMap< String, ObjectPair< IAudio > >, Murl::ObjectMap< String, PackagePair >, Murl::ObjectMap< UInt64, Entry >, Murl::ObjectMap< UInt32, Raw::CubicBezierParameterSet >, Murl::ObjectMap< UInt64, AllocationEntry >, Murl::ObjectMap< String, ObjectPair< IBinary > >, Murl::ObjectMap< String, ObjectPair< IVideo > >, Murl::ObjectMap< Murl::String, Murl::IAttributes * >, Murl::ObjectMap< Murl::String, AppStoreProduct >, Murl::ObjectMap< String, ObjectPair< IScript > >, Murl::ObjectMap< const UInt8 *, FileHandle >, Murl::ObjectMap< UInt64, ReferenceEntry >, Murl::ObjectMap< String, ObjectPair< IText > >, Murl::ObjectMap< String, ObjectPair< IMesh > >, Murl::ObjectMap< Murl::String, EvaluatorFunction >, Murl::ObjectMap< String, ObjectPair< IGraph > >, Murl::ObjectMap< Murl::Graph::IClip *, ClipItem >, Murl::ObjectMap< String, ObjectPair< IDictionary > >, Murl::ObjectMap< String, ObjectPair< IAnimation > >, Murl::ObjectMap< String, ObjectPair< IShader > >, Murl::ObjectMap< String, ObjectPair< IAtlas > >, Murl::ObjectMap< String, ObjectPair< IImage > >, Murl::ObjectMap< String, ObjectPair< IObject > >, and Murl::ObjectMap< UInt32, Renderbuffer >.
Public Types | |
using | KeyValueType = KeyType |
The template key parameter value type. | |
using | ValueType = DataType |
The template data parameter value type. | |
using | KeyIndexType = Index< KeyType, HashFunc > |
Definition of the key index type. | |
using | KeyConstIterator = typename KeyIndexType::ConstIterator |
Definition of the const key iterator. | |
using | ConstIterator = typename ArrayType::ConstIterator |
Definition of the const iterator. | |
using | Iterator = typename ArrayType::Iterator |
Definition of the iterator. | |
Public Member Functions | |
void | Clear () |
Clear the map and remove the underlying storage. | |
void | Empty () |
Empty the map, but keep the underlying storage. | |
void | Shrink () |
Shrink the map so that the underlying key and value storage is only as large as necessary. | |
void | Trim (SInt32 n) |
Reduce the map to a given number of items. More... | |
void | Drop (SInt32 n=1) |
Reduce the map by removing a given number of items from the end. More... | |
void | Reserve (SInt32 n) |
Reserve storage space. More... | |
void | Sweep () |
Remove any unlinked pairs from the map. | |
void | SetKey (SInt32 index, const KeyType &key) |
Set the key of a given index. More... | |
void | Swap (MapBase &other) |
Exchange the content of the map with a given second one. More... | |
DataType & | Add (const KeyType &key) |
Add a new key/value pair to the map. More... | |
DataType & | Add (const KeyType &key, const DataType &value) |
Add a key/value pair to the map. More... | |
DataType & | Put (const KeyType &key) |
Add a new key/value pair to the map, replacing an unlinked element if present. More... | |
SInt32 | Put (const KeyType &key, const DataType &value) |
Add a key/value pair to the map, replacing an unlinked element if present. More... | |
DataType & | Insert (SInt32 index, const KeyType &key) |
Insert a new key/value pair into the map at a given position. More... | |
DataType & | Insert (SInt32 index, const KeyType &key, const DataType &value) |
Insert a key/value pair into the map at a given position. More... | |
void | Unlink (SInt32 index) |
Unlink the pair at a given index. More... | |
SInt32 | UnlinkKey (const KeyType &key) |
Unlink all pairs matching a given key. More... | |
SInt32 | UnlinkKey (const KeyType &key, UInt32 hash) |
Unlink all pairs matching a given key, using a precomputed hash value. More... | |
Bool | IsUnlinked (SInt32 index) const |
Check if the pair at a given index is unlinked. More... | |
Bool | HasUnlinked () const |
Check if the map has unlinked items. More... | |
SInt32Array | GetUnlinked () const |
Get an array of indices of all unlinked items. More... | |
void | Remove (SInt32 index) |
Remove the key/value pair at a given position from the map. More... | |
void | Remove (SInt32 index, SInt32 count) |
Remove a number of key/value pairs from the map at a given starting position. More... | |
void | Remove (const SInt32 *sortedIndices, SInt32 count) |
Remove a number of key/value pairs from the map at given positions. More... | |
void | Remove (const SInt32Array &sortedIndices) |
Remove a number of key/value pairs from the map at given positions. More... | |
SInt32 | RemoveKey (const KeyType &key) |
Remove all pairs from the map that match a given key. More... | |
SInt32 | Find (const KeyType &key) const |
Find the first occurrence of a given key in the map. More... | |
SInt32 | Find (const KeyType &key, UInt32 hash) const |
Find the first occurrence of a given key in the map, using a precomputed hash value. More... | |
SInt32 | FindLast (const KeyType &key) const |
Find the last occurrence of a given key in the map. More... | |
SInt32 | FindLast (const KeyType &key, UInt32 hash) const |
Find the last occurrence of a given key in the map, using a precomputed hash value. More... | |
SInt32 | FindNext (SInt32 index) const |
Find the next occurrence of a key that is specified by a given index. More... | |
SInt32 | FindPrev (SInt32 index) const |
Find the previous occurrence of a key that is specified by a given index. More... | |
SInt32 | FindAdd (const KeyType &key) |
Find the first occurrence of a given key in the map, or add a new pair if the key was not found. More... | |
SInt32 | FindAdd (const KeyType &key, const DataType &value) |
Find the first occurrence of a given key in the map, or add a new pair if the key was not found. More... | |
SInt32 | FindPut (const KeyType &key) |
Find the first occurrence of a given key in the map, or add a new pair if the key was not found, hereby replacing an unlinked element if possible. More... | |
SInt32 | FindPut (const KeyType &key, const DataType &value) |
Find the first occurrence of a given key in the map, or add a new pair if the key was not found, hereby replacing an unlinked element if possible. More... | |
DataType & | Get (const KeyType &key) |
Get a reference to the first occurrence of a given key in the map. More... | |
const DataType & | Get (const KeyType &key) const |
Get a const reference to the first occurrence of a given key in the map. More... | |
const DataType & | Get (const KeyType &key, const DataType &defaultValue) const |
Get a const reference to the first occurrence of a given key in the map. More... | |
DataType * | GetPtr (const KeyType &key) |
Get a pointer to the first occurrence of a given key in the map. More... | |
const DataType * | GetPtr (const KeyType &key) const |
Get a const pointer to the first occurrence of a given key in the map. More... | |
DataType & | GetAdd (const KeyType &key) |
Get a reference to the first occurrence of a given key in the map, or add a new pair if the key was not found. More... | |
DataType & | GetAdd (const KeyType &key, const DataType &value) |
Get a reference to the first occurrence of a given key in the map, or add a new pair if the key was not found. More... | |
DataType & | GetPut (const KeyType &key) |
Get a reference to the first occurrence of a given key in the map, or add a new pair if the key was not found, hereby replacing an unlinked element if possible. More... | |
DataType & | GetPut (const KeyType &key, const DataType &value) |
Get a reference to the first occurrence of a given key in the map, or add a new pair if the key was not found, hereby replacing an unlinked element if possible. More... | |
const KeyType & | GetKey (SInt32 index) const |
Get a const reference to the key at a given index. More... | |
const KeyIndexType & | GetIndex () const |
Get a const reference to the key storage. More... | |
const Array< KeyType > & | GetKeys () const |
Get a const reference to the array of keys. More... | |
ArrayType & | GetValues () |
Get a reference to the array of values. More... | |
const ArrayType & | GetValues () const |
Get a const reference to the array of values. More... | |
Bool | IsIndexValid (SInt32 index) const |
Check if a given index is a valid index. More... | |
const DataType & | operator[] (SInt32 index) const |
Get a const reference to the value at a given index. More... | |
DataType & | operator[] (SInt32 index) |
Get a reference to the value at a given index. More... | |
DataType & | Front () |
Get a reference to the first value in the storage. More... | |
const DataType & | Front () const |
Get a const reference to the first value in the storage. More... | |
const KeyType & | FrontKey () const |
Get a const reference to the first key in the storage. More... | |
DataType & | Back () |
Get a reference to the last value in the storage. More... | |
const DataType & | Back () const |
Get a const reference to the last value in the storage. More... | |
const KeyType & | BackKey () const |
Get a const reference to the last key in the storage. More... | |
DataType & | Bottom () |
Get a reference to the first value in the storage. More... | |
const DataType & | Bottom () const |
Get a const reference to the first value in the storage. More... | |
const KeyType & | BottomKey () const |
Get a const reference to the first key in the storage. More... | |
DataType & | Top () |
Get a reference to the last value in the storage. More... | |
const DataType & | Top () const |
Get a const reference to the last value in the storage. More... | |
const KeyType & | TopKey () const |
Get a const reference to the last key in the storage. More... | |
KeyType | PopKey () |
Remove the last key/value pair from the map and return its key. More... | |
SInt32 | GetAlloc () const |
Get the number of actually allocated pairs. More... | |
SInt32 | GetCount () const |
Get the number of items in the map. More... | |
UInt32 | GetCountUInt32 () const |
Get the number of items in the map. More... | |
Bool | IsEmpty () const |
Check if the map is empty. More... | |
KeyConstIterator | KeyBegin () const |
Get the const key iterator to the first element. More... | |
KeyConstIterator | KeyEnd () const |
Get the const key iterator next to the last element. More... | |
KeyConstIterator | KeyGetIter (SInt32 index) const |
Get the const key iterator of a specified index. More... | |
ConstIterator | Begin () const |
Get the const iterator to the first element. More... | |
ConstIterator | End () const |
Get the const iterator next to the last element. More... | |
ConstIterator | GetIter (SInt32 index) const |
Get the const iterator of a specified index. More... | |
Iterator | Begin () |
Get the iterator to the first element. More... | |
Iterator | End () |
Get the iterator next to the last element. More... | |
Iterator | GetIter (SInt32 index) |
Get the iterator of a specified index. More... | |
Bool | IsEqual (const MapBase &other) const |
Compare the map to another one. More... | |
bool | operator== (const MapBase &rhs) const |
The "equal to" comparison operator, calls IsEqual(). More... | |
bool | operator!= (const MapBase &rhs) const |
The "not equal to" comparison operator, calls IsEqual(). More... | |
Detailed Description
template<class KeyType, class DataType, class ArrayType, class HashFunc>
class Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >
A generic map template base class.
A map stores a number of key/value pairs, where the keys do not have to be unique.
This is the base class of the Map and ObjectMap class.
This class is based on the NTL AMap container, see http://www.ultimatepp.org
- Template Parameters
-
KeyType The key's data type of the map. DataType The value's data type of the map. ArrayType The array type of the values. HashFunc The hash function of the key.
Member Function Documentation
◆ Trim()
|
inline |
Reduce the map to a given number of items.
- Parameters
-
n The new number of items in the map, must be smaller than the current item count.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Trim().
◆ Drop()
|
inline |
Reduce the map by removing a given number of items from the end.
- Parameters
-
n The number of items to remove from the end.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Drop().
Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::PopKey().
◆ Reserve()
|
inline |
Reserve storage space.
If the given size is less than the actual size, nothing is done.
- Parameters
-
n The number of items the underlying storage should hold.
◆ SetKey()
|
inline |
Set the key of a given index.
- Parameters
-
index The index to replace. key The new key.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Set().
◆ Swap()
|
inline |
Exchange the content of the map with a given second one.
- Parameters
-
other The second map.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Swap().
◆ Add() [1/2]
|
inline |
Add a new key/value pair to the map.
The newly added value is initialized using the value type's default constructor.
- Parameters
-
key The key under which the value can be retrieved.
- Returns
- A reference to the newly constructed value.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Add().
◆ Add() [2/2]
|
inline |
Add a key/value pair to the map.
The newly added value is initialized using the given reference value's copy constructor.
- Parameters
-
key The key under which the value can be retrieved. value The reference value to add.
- Returns
- A reference to the newly constructed value.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Add().
◆ Put() [1/2]
|
inline |
Add a new key/value pair to the map, replacing an unlinked element if present.
The newly added value is initialized using the value type's default constructor.
- Parameters
-
key The key under which the value can be retrieved.
- Returns
- A reference to the newly added value.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Put().
◆ Put() [2/2]
|
inline |
Add a key/value pair to the map, replacing an unlinked element if present.
The newly added value is initialized using the given reference value's copy constructor.
- Parameters
-
key The key under which the value can be retrieved. value The reference value to add.
- Returns
- The index of the pair in the map.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Put().
◆ Insert() [1/2]
|
inline |
Insert a new key/value pair into the map at a given position.
The newly added value is initialized using the value type's default constructor.
- Parameters
-
index The index where to insert the new pair. key The key under which the value can be retrieved.
- Returns
- A reference to the newly constructed value.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Insert().
◆ Insert() [2/2]
|
inline |
Insert a key/value pair into the map at a given position.
The newly added value is initialized using the given reference value's copy constructor.
- Parameters
-
index The index where to insert the new pair. key The key under which the value can be retrieved. value The reference value to insert.
- Returns
- A reference to the newly constructed value.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Insert().
◆ Unlink()
|
inline |
Unlink the pair at a given index.
Unlinked elements remain in the map, but are ignored by any search operations.
- Parameters
-
index The index of the pair to unlink.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Unlink().
◆ UnlinkKey() [1/2]
|
inline |
Unlink all pairs matching a given key.
Unlinked elements remain in the map, but are ignored by any search operations.
- Parameters
-
key The key for which to unlink all elements.
- Returns
- The number of elements that were unlinked.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::UnlinkKey().
◆ UnlinkKey() [2/2]
|
inline |
Unlink all pairs matching a given key, using a precomputed hash value.
Unlinked elements remain in the map, but are ignored by any search operations.
- Parameters
-
key The key for which to unlink all elements. hash The precomputed hash value.
- Returns
- The number of elements that were unlinked.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::UnlinkKey().
◆ IsUnlinked()
|
inline |
Check if the pair at a given index is unlinked.
- Parameters
-
index The index of the pair to check.
- Returns
- true if the pair is unlinked.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::IsUnlinked().
◆ HasUnlinked()
|
inline |
Check if the map has unlinked items.
- Returns
- true if there is at least one unlinked item.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::HasUnlinked().
◆ GetUnlinked()
|
inline |
Get an array of indices of all unlinked items.
- Returns
- The array of indices.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::GetUnlinked().
◆ Remove() [1/4]
|
inline |
Remove the key/value pair at a given position from the map.
- Parameters
-
index The zero-based index from where to remove the pair.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Remove().
Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Remove(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::RemoveKey().
◆ Remove() [2/4]
|
inline |
Remove a number of key/value pairs from the map at a given starting position.
- Parameters
-
index The zero-based index from where to remove the first pair. count The number of subsequent pairs to remove.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Remove().
◆ Remove() [3/4]
|
inline |
Remove a number of key/value pairs from the map at given positions.
- Parameters
-
sortedIndices A pointer to sorted indices where to remove the pairs. count The number of pairs to remove, i.e. the number of indices.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Remove().
◆ Remove() [4/4]
|
inline |
Remove a number of key/value pairs from the map at given positions.
- Parameters
-
sortedIndices A sorted array of indices where to remove the items.
References Murl::Array< DataType >::GetCount(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Remove().
◆ RemoveKey()
|
inline |
Remove all pairs from the map that match a given key.
- Parameters
-
key The key for which to remove the pairs.
- Returns
- The number of pairs that were removed.
References Murl::Array< DataType >::Add(), Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Find(), Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::FindNext(), Murl::Array< DataType >::GetCount(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Remove().
◆ Find() [1/2]
|
inline |
Find the first occurrence of a given key in the map.
- Parameters
-
key The key to search for.
- Returns
- The index of the pair in the map, or -1 if not found.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Find().
Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::FindAdd(), Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::FindPut(), Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Get(), Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::GetAdd(), Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::GetPtr(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::RemoveKey().
◆ Find() [2/2]
|
inline |
Find the first occurrence of a given key in the map, using a precomputed hash value.
- Parameters
-
key The key to search for. hash The precomputed hash value.
- Returns
- The index of the pair in the map, or -1 if not found.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Find().
◆ FindLast() [1/2]
|
inline |
Find the last occurrence of a given key in the map.
- Parameters
-
key The key to search for.
- Returns
- The index of the pair in the map, or -1 if not found.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindLast().
◆ FindLast() [2/2]
|
inline |
Find the last occurrence of a given key in the map, using a precomputed hash value.
- Parameters
-
key The key to search for. hash The precomputed hash value.
- Returns
- The index of the pair in the map, or -1 if not found.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindLast().
◆ FindNext()
|
inline |
Find the next occurrence of a key that is specified by a given index.
- Parameters
-
index The index of the pair containing the key to search for.
- Returns
- The index of the next pair in the map, or -1 if not found.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindNext().
Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::RemoveKey().
◆ FindPrev()
|
inline |
Find the previous occurrence of a key that is specified by a given index.
- Parameters
-
index The index of the pair containing the key to search for.
- Returns
- The index of the previous pair in the map, or -1 if not found.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindPrev().
◆ FindAdd() [1/2]
|
inline |
Find the first occurrence of a given key in the map, or add a new pair if the key was not found.
If a pair needs to be added, the newly created value is initialized using the value type's default constructor.
- Parameters
-
key The key to search for.
- Returns
- The index of the pair in the map.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Add(), Murl::IndexBase< KeyType, ArrayType, HashFunc >::CalculateHash(), Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Find(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::GetCount().
Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::GetPut().
◆ FindAdd() [2/2]
|
inline |
Find the first occurrence of a given key in the map, or add a new pair if the key was not found.
If a pair needs to be added, the newly created value is initialized using the given value's copy constructor.
- Parameters
-
key The key to search for. value The reference value to add.
- Returns
- The index of the pair in the map.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Add(), Murl::IndexBase< KeyType, ArrayType, HashFunc >::CalculateHash(), Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Find(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::GetCount().
◆ FindPut() [1/2]
|
inline |
Find the first occurrence of a given key in the map, or add a new pair if the key was not found, hereby replacing an unlinked element if possible.
If a pair needs to be added, the newly created value is initialized using the value type's default constructor.
- Parameters
-
key The key to search for.
- Returns
- The index of the pair in the map.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::CalculateHash(), Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Find(), and Murl::IndexBase< KeyType, ArrayType, HashFunc >::Put().
◆ FindPut() [2/2]
|
inline |
Find the first occurrence of a given key in the map, or add a new pair if the key was not found, hereby replacing an unlinked element if possible.
If a pair needs to be added, the newly created value is initialized using the given value's copy constructor.
- Parameters
-
key The key to search for. value The reference value to add.
- Returns
- The index of the pair in the map.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::CalculateHash(), Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Find(), and Murl::IndexBase< KeyType, ArrayType, HashFunc >::Put().
◆ Get() [1/3]
|
inline |
Get a reference to the first occurrence of a given key in the map.
If the key was not found, the behaviour is undefined.
- Parameters
-
key The key to search for.
- Returns
- A reference to the value of the first pair found.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Find().
◆ Get() [2/3]
|
inline |
Get a const reference to the first occurrence of a given key in the map.
If the key was not found, the behaviour is undefined.
- Parameters
-
key The key to search for.
- Returns
- A const reference to the value of the first pair found.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Find().
◆ Get() [3/3]
|
inline |
Get a const reference to the first occurrence of a given key in the map.
If the key was not found, the given default value is returned
- Parameters
-
key The key to search for. defaultValue The default value to return if the key was not found.
- Returns
- A const reference to the value of the first pair, or the given default value.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Find().
◆ GetPtr() [1/2]
|
inline |
Get a pointer to the first occurrence of a given key in the map.
If the key was not found, a null pointer is returned.
- Parameters
-
key The key to search for.
- Returns
- A pointer to the value of the first pair found, or null.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Find().
◆ GetPtr() [2/2]
|
inline |
Get a const pointer to the first occurrence of a given key in the map.
If the key was not found, a null pointer is returned.
- Parameters
-
key The key to search for.
- Returns
- A const pointer to the value of the first pair found, or null.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Find().
◆ GetAdd() [1/2]
|
inline |
Get a reference to the first occurrence of a given key in the map, or add a new pair if the key was not found.
If a pair needs to be added, the newly created value is initialized using the value type's default constructor.
- Parameters
-
key The key to search for.
- Returns
- A reference to the value of the first pair found.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Add(), Murl::IndexBase< KeyType, ArrayType, HashFunc >::CalculateHash(), and Murl::IndexBase< KeyType, ArrayType, HashFunc >::Find().
◆ GetAdd() [2/2]
|
inline |
Get a reference to the first occurrence of a given key in the map, or add a new pair if the key was not found.
If a pair needs to be added, the newly created value is initialized using the given value's copy constructor.
- Parameters
-
key The key to search for. value The reference value to add.
- Returns
- A reference to the value of the first pair found.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Add(), Murl::IndexBase< KeyType, ArrayType, HashFunc >::CalculateHash(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Find().
◆ GetPut() [1/2]
|
inline |
Get a reference to the first occurrence of a given key in the map, or add a new pair if the key was not found, hereby replacing an unlinked element if possible.
If a pair needs to be added, the newly created value is initialized using the value type's default constructor.
- Parameters
-
key The key to search for.
- Returns
- A reference to the value of the first pair found.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::FindAdd().
◆ GetPut() [2/2]
|
inline |
Get a reference to the first occurrence of a given key in the map, or add a new pair if the key was not found, hereby replacing an unlinked element if possible.
If a pair needs to be added, the newly created value is initialized using the given value's copy constructor.
- Parameters
-
key The key to search for. value The reference value to add.
- Returns
- A reference to the value of the first pair found.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::FindAdd().
◆ GetKey()
|
inline |
Get a const reference to the key at a given index.
If the index is out of range, the behaviour is undefined.
- Parameters
-
index The index of the key to retrieve.
- Returns
- A const reference to the requested key.
◆ GetIndex()
|
inline |
Get a const reference to the key storage.
- Returns
- A const reference to the underlying key storage.
◆ GetKeys()
|
inline |
Get a const reference to the array of keys.
- Returns
- A const reference to the underlying key storage array.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::GetKeys().
◆ GetValues() [1/2]
|
inline |
Get a reference to the array of values.
- Returns
- A reference to the underlying value array.
◆ GetValues() [2/2]
|
inline |
Get a const reference to the array of values.
- Returns
- A const reference to the underlying value array.
◆ IsIndexValid()
|
inline |
Check if a given index is a valid index.
- Parameters
-
index The index to check.
- Returns
- true if index >= 0 and index < GetCount().
◆ operator[]() [1/2]
|
inline |
Get a const reference to the value at a given index.
If the index is out of range, the behaviour is undefined.
- Parameters
-
index The index of the value to retrieve.
- Returns
- A reference to the requested value.
◆ operator[]() [2/2]
|
inline |
Get a reference to the value at a given index.
If the index is out of range, the behaviour is undefined.
- Parameters
-
index The index of the value to retrieve.
- Returns
- A const reference to the requested value.
◆ Front() [1/2]
|
inline |
Get a reference to the first value in the storage.
Synonymous to Bottom().
- Returns
- A reference to the first value.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Bottom().
◆ Front() [2/2]
|
inline |
Get a const reference to the first value in the storage.
Synonymous to Bottom().
- Returns
- A const reference to the first value.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Bottom().
◆ FrontKey()
|
inline |
Get a const reference to the first key in the storage.
Synonymous to BottomKey().
- Returns
- A const reference to the first key.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::BottomKey().
◆ Back() [1/2]
|
inline |
Get a reference to the last value in the storage.
Synonymous to Top().
- Returns
- A reference to the last value.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Top().
◆ Back() [2/2]
|
inline |
Get a const reference to the last value in the storage.
Synonymous to Top().
- Returns
- A const reference to the last value.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Top().
◆ BackKey()
|
inline |
Get a const reference to the last key in the storage.
Synonymous to TopKey().
- Returns
- A const reference to the last key.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::TopKey().
◆ Bottom() [1/2]
|
inline |
Get a reference to the first value in the storage.
- Returns
- A reference to the first value.
Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Front().
◆ Bottom() [2/2]
|
inline |
Get a const reference to the first value in the storage.
- Returns
- A const reference to the first value.
◆ BottomKey()
|
inline |
Get a const reference to the first key in the storage.
- Returns
- A const reference to the first key.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Bottom().
Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::FrontKey().
◆ Top() [1/2]
|
inline |
Get a reference to the last value in the storage.
- Returns
- A reference to the last value.
Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Back().
◆ Top() [2/2]
|
inline |
Get a const reference to the last value in the storage.
- Returns
- A const reference to the last value.
◆ TopKey()
|
inline |
Get a const reference to the last key in the storage.
- Returns
- A const reference to the last key.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Top().
Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::BackKey(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::PopKey().
◆ PopKey()
|
inline |
Remove the last key/value pair from the map and return its key.
- Returns
- The key of the removed pair.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Drop(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::TopKey().
◆ GetAlloc()
|
inline |
Get the number of actually allocated pairs.
- Returns
- The number of allocated pairs.
◆ GetCount()
|
inline |
Get the number of items in the map.
- Returns
- The number of items.
Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::FindAdd().
◆ GetCountUInt32()
|
inline |
Get the number of items in the map.
- Returns
- The number of items.
◆ IsEmpty()
|
inline |
Check if the map is empty.
- Returns
- true if the map is empty, false otherwise.
◆ KeyBegin()
|
inline |
Get the const key iterator to the first element.
- Returns
- The const key iterator to the first element.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Begin().
◆ KeyEnd()
|
inline |
Get the const key iterator next to the last element.
- Returns
- The const key iterator next to the last element.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::End().
◆ KeyGetIter()
|
inline |
Get the const key iterator of a specified index.
- Parameters
-
index The index for the key iterator.
- Returns
- The const key iterator or null if the index is out of range.
References Murl::IndexBase< KeyType, ArrayType, HashFunc >::GetIter().
◆ Begin() [1/2]
|
inline |
Get the const iterator to the first element.
- Returns
- The const iterator to the first element.
◆ End() [1/2]
|
inline |
Get the const iterator next to the last element.
- Returns
- The const iterator next to the last element.
◆ GetIter() [1/2]
|
inline |
Get the const iterator of a specified index.
- Parameters
-
index The index for the iterator.
- Returns
- The const iterator or null if the index is out of range.
◆ Begin() [2/2]
|
inline |
Get the iterator to the first element.
- Returns
- The iterator to the first element.
◆ End() [2/2]
|
inline |
Get the iterator next to the last element.
- Returns
- The iterator next to the last element.
◆ GetIter() [2/2]
|
inline |
Get the iterator of a specified index.
- Parameters
-
index The index for the iterator.
- Returns
- The iterator or null if the index is out of range.
◆ IsEqual()
|
inline |
Compare the map to another one.
- Parameters
-
other The map to compare.
- Returns
- true if all key value pairs have identical contents.
Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::operator!=(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::operator==().
◆ operator==()
|
inline |
The "equal to" comparison operator, calls IsEqual().
- Parameters
-
rhs The right hand side map to compare.
- Returns
- true if all key value pairs have identical contents.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::IsEqual().
◆ operator!=()
|
inline |
The "not equal to" comparison operator, calls IsEqual().
- Parameters
-
rhs The right hand side map to compare.
- Returns
- true if the maps differ.
References Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::IsEqual().
The documentation for this class was generated from the following file:
- murl_map_base.h