Murl::IndexBase< KeyType, ArrayType, HashFunc > Class Template Reference

A generic index template base class. More...

#include "murl_index_base.h"

Inheritance diagram for Murl::IndexBase< KeyType, ArrayType, HashFunc >:

Public Types

using ConstIterator = typename ArrayType::ConstIterator
 Definition of the const iterator.
 

Public Member Functions

void Clear ()
 Clear the index object and remove the underlying storage.
 
void ClearIndex ()
 Clear the hash index.
 
void Empty ()
 Empty the index object, but keep the underlying storage.
 
void RebuildHash (const SInt32 n)
 Clear and rebuild the hash index for a given number of items. More...
 
void RebuildHash ()
 Clear and rebuild the hash index.
 
void Shrink ()
 Shrink the index object so that the underlying storage is only as large as necessary.
 
void Trim (SInt32 n)
 Reduce the index object to a given number of items. More...
 
void Drop (SInt32 n=1)
 Reduce the index object by removing a given number of items from the end. More...
 
void Reserve (SInt32 n)
 Reserve storage space. More...
 
void Unlink (const SInt32 index)
 Unlink the item at a given index. More...
 
SInt32 UnlinkKey (const KeyType &key)
 Unlink all items matching a given key. More...
 
SInt32 UnlinkKey (const KeyType &key, const UInt32 hash)
 Unlink all items matching a given key, using a pre calculated hash value. More...
 
Bool IsUnlinked (const SInt32 index) const
 Check if the item at a given index is unlinked. More...
 
Bool HasUnlinked () const
 Check if the index has unlinked items. More...
 
SInt32Array GetUnlinked () const
 Get an array of indices of all unlinked items. More...
 
void Sweep ()
 Remove all unlinked items from the index.
 
KeyType & Set (SInt32 index, const KeyType &key, const UInt32 hash)
 Replace the item at a specified index using a precomputed hash. More...
 
KeyType & Set (const SInt32 index, const KeyType &key)
 Replace the item at a specified index. More...
 
KeyType & Add (const KeyType &key, const UInt32 hash)
 Add an item with a precomputed hash value. More...
 
KeyType & Add (const KeyType &key)
 Add an item. More...
 
SInt32 Put (const KeyType &key, const UInt32 hash)
 Add an item or replace an unlinked item if present, using a precomputed hash value. More...
 
SInt32 Put (const KeyType &key)
 Add an item or replace an unlinked item if present. More...
 
SInt32 FindAdd (const KeyType &key, const UInt32 hash)
 Find the first occurrence of a given item in the index, or add an item if the item was not found, using a precomputed hash value. More...
 
SInt32 FindAdd (const KeyType &key)
 Find the first occurrence of a given item in the index, or add an item if the item was not found. More...
 
SInt32 FindPut (const KeyType &key, const UInt32 hash)
 Find the first occurrence of a given item or add the item if the item was not found, using a precomputed hash value. More...
 
SInt32 FindPut (const KeyType &key)
 Find the first occurrence of a given item or put the item if the item was not found. More...
 
SInt32 Find (const KeyType &key, const UInt32 hash) const
 Find the first occurrence of a given item using a precomputed hash value. More...
 
SInt32 Find (const KeyType &key) const
 Find the first occurrence of a given item. More...
 
SInt32 FindNext (SInt32 index) const
 Find the next occurrence of an item that is specified by a given index. More...
 
SInt32 FindPrev (SInt32 index) const
 Find the previous occurrence of an item that is specified by a given index. More...
 
SInt32 FindLast (const KeyType &key, const UInt32 hash) const
 Find the last occurrence of a given item, using a precomputed hash value. More...
 
SInt32 FindLast (const KeyType &key) const
 Find the last occurrence of a given item. More...
 
KeyType & Insert (SInt32 index, const KeyType &key, const UInt32 hash)
 Insert an item at a given position, using a precomputed hash value. More...
 
KeyType & Insert (SInt32 index, const KeyType &key)
 Insert an item at a given position. More...
 
void Remove (SInt32 index)
 Remove the item at a given position. More...
 
void Remove (SInt32 index, SInt32 count)
 Remove a number of items at a given starting position. More...
 
void Remove (const SInt32 *sortedIndices, SInt32 count)
 Remove a number of items at given positions. More...
 
void Remove (const SInt32Array &sortedIndices)
 Remove a number of items at given positions. More...
 
SInt32 RemoveKey (const KeyType &key, const UInt32 hash)
 Remove all items that match a given item, using a precomputed hash value. More...
 
SInt32 RemoveKey (const KeyType &key)
 Remove all items that match a given item. More...
 
const KeyType & Front () const
 Get a reference to the first item. More...
 
const KeyType & Back () const
 Get a reference to the last item. More...
 
const KeyType & Bottom () const
 Get a reference to the first item. More...
 
const KeyType & Top () const
 Get a reference to the last item. More...
 
Bool IsIndexValid (SInt32 index) const
 Check if a given index is a valid index. More...
 
const KeyType & operator[] (SInt32 index) const
 Get a const reference to the item at a given index. More...
 
const KeyType & Get (SInt32 index) const
 Get a const reference to the item at a given index. More...
 
SInt32 GetAlloc () const
 Get the number of actually allocated items. More...
 
SInt32 GetCount () const
 Get the number of items. More...
 
Bool IsEmpty () const
 Check if the Index is empty. More...
 
const ArrayType & GetKeys () const
 Get a const reference to the array of items. More...
 
void Swap (IndexBase &other)
 Exchange the content of the index object with a given second one. More...
 
ConstIterator Begin () const
 Get the const iterator to the first item. More...
 
ConstIterator End () const
 Get the const iterator next to the last item. More...
 
ConstIterator GetIter (SInt32 index) const
 Get the const iterator of a specified index. More...
 
SInt32 GetIterIndex (ConstIterator iterator) const
 Get the item index by iterator. More...
 
UInt32 CalculateHash (const KeyType &key) const
 Calculate the hash for an item. More...
 
Bool IsEqual (const IndexBase &other) const
 Compare the index to another one. More...
 
bool operator== (const IndexBase &rhs) const
 The "equal to" comparison operator, calls IsEqual(). More...
 
bool operator!= (const IndexBase &rhs) const
 The "not equal to" comparison operator, calls IsEqual(). More...
 

Detailed Description

template<class KeyType, class ArrayType, class HashFunc>
class Murl::IndexBase< KeyType, ArrayType, HashFunc >

A generic index template base class.

The index class stores a number of (not necessarily unique) keys in a hash table.
This is the base class of the Index and ObjectIndex class.
This class is based on the NTL AIndex container, see http://www.ultimatepp.org

Template Parameters
KeyTypeThe key's data type of the index.
ArrayTypeThe array type of the keys.
HashFuncThe hash function of the key.

Member Function Documentation

◆ RebuildHash()

template<class KeyType , class ArrayType , class HashFunc >
void Murl::IndexBase< KeyType, ArrayType, HashFunc >::RebuildHash ( const SInt32  n)
inline

Clear and rebuild the hash index for a given number of items.

Parameters
nThe number of items to rebuild.

References Murl::Hash::Reindex().

◆ Trim()

template<class KeyType , class ArrayType , class HashFunc >
void Murl::IndexBase< KeyType, ArrayType, HashFunc >::Trim ( SInt32  n)
inline

Reduce the index object to a given number of items.

Parameters
nThe new number of items in the index, must be smaller than the current item count.

References Murl::Hash::Trim().

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Trim().

◆ Drop()

template<class KeyType , class ArrayType , class HashFunc >
void Murl::IndexBase< KeyType, ArrayType, HashFunc >::Drop ( SInt32  n = 1)
inline

Reduce the index object by removing a given number of items from the end.

Parameters
nThe number of items to remove from the end.

References Murl::Hash::Drop().

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Drop().

◆ Reserve()

template<class KeyType , class ArrayType , class HashFunc >
void Murl::IndexBase< KeyType, ArrayType, HashFunc >::Reserve ( SInt32  n)
inline

Reserve storage space.

If the given size is less than the actual size, nothing is done.

Parameters
nThe number of items the underlying storage should hold.

References Murl::Hash::Reserve().

Referenced by Murl::ObjectMap< Murl::String, EvaluatorVariable >::Insert().

◆ Unlink()

template<class KeyType , class ArrayType , class HashFunc >
void Murl::IndexBase< KeyType, ArrayType, HashFunc >::Unlink ( const SInt32  index)
inline

Unlink the item at a given index.

Unlinked items remain in the Index, but are ignored by any search operations.

Parameters
indexThe index of the item to unlink.

References Murl::Hash::Unlink().

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Unlink().

◆ UnlinkKey() [1/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::UnlinkKey ( const KeyType &  key)
inline

Unlink all items matching a given key.

Unlinked items remain in the Index, but are ignored by any search operations.

Parameters
keyThe key of the item(s) to unlink.
Returns
The number of items that were unlinked.

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::UnlinkKey().

◆ UnlinkKey() [2/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::UnlinkKey ( const KeyType &  key,
const UInt32  hash 
)
inline

Unlink all items matching a given key, using a pre calculated hash value.

Unlinked items remain in the Index, but are ignored by any search operations.

Parameters
keyThe key of the item(s) to unlink.
hashThe pre calculated hash value.
Returns
The number of items that were unlinked.

References Murl::Hash::Find(), Murl::Hash::FindNext(), and Murl::Hash::Unlink().

◆ IsUnlinked()

template<class KeyType , class ArrayType , class HashFunc >
Bool Murl::IndexBase< KeyType, ArrayType, HashFunc >::IsUnlinked ( const SInt32  index) const
inline

Check if the item at a given index is unlinked.

Parameters
indexThe index of the item to check.
Returns
true if the specified item is unlinked.

References Murl::Hash::IsUnlinked().

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::IsUnlinked().

◆ HasUnlinked()

template<class KeyType , class ArrayType , class HashFunc >
Bool Murl::IndexBase< KeyType, ArrayType, HashFunc >::HasUnlinked ( ) const
inline

Check if the index has unlinked items.

Returns
true if there is at least one unlinked item.

References Murl::Hash::HasUnlinked().

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::HasUnlinked(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Sweep().

◆ GetUnlinked()

template<class KeyType , class ArrayType , class HashFunc >
SInt32Array Murl::IndexBase< KeyType, ArrayType, HashFunc >::GetUnlinked ( ) const
inline

Get an array of indices of all unlinked items.

Returns
The array of indices.

References Murl::Hash::GetUnlinked().

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::GetUnlinked(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Sweep().

◆ Set() [1/2]

template<class KeyType , class ArrayType , class HashFunc >
KeyType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::Set ( SInt32  index,
const KeyType &  key,
const UInt32  hash 
)
inline

Replace the item at a specified index using a precomputed hash.

Parameters
indexThe index to set.
keyThe value to set.
hashThe precomputed hash.
Returns
A reference to the set item.

References Murl::Hash::Set().

Referenced by Murl::IndexBase< KeyType, ArrayType, HashFunc >::Set(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::SetKey().

◆ Set() [2/2]

template<class KeyType , class ArrayType , class HashFunc >
KeyType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::Set ( const SInt32  index,
const KeyType &  key 
)
inline

Replace the item at a specified index.

Parameters
indexThe index to set.
keyThe value to set.
Returns
A reference to the set item.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Set().

◆ Add() [1/2]

template<class KeyType , class ArrayType , class HashFunc >
KeyType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::Add ( const KeyType &  key,
const UInt32  hash 
)
inline

◆ Add() [2/2]

template<class KeyType , class ArrayType , class HashFunc >
KeyType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::Add ( const KeyType &  key)
inline

Add an item.

Parameters
keyThe item to add.
Returns
A reference to the added item.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Add().

◆ Put() [1/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::Put ( const KeyType &  key,
const UInt32  hash 
)
inline

Add an item or replace an unlinked item if present, using a precomputed hash value.

Parameters
keyThe item to add.
hashThe precomputed hash.
Returns
The index of the item.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Add(), and Murl::Hash::Put().

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::FindPut(), Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindPut(), Murl::IndexBase< KeyType, ArrayType, HashFunc >::Put(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Put().

◆ Put() [2/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::Put ( const KeyType &  key)
inline

Add an item or replace an unlinked item if present.

Parameters
keyThe item to add.
Returns
The index of the item.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Put().

◆ FindAdd() [1/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindAdd ( const KeyType &  key,
const UInt32  hash 
)
inline

Find the first occurrence of a given item in the index, or add an item if the item was not found, using a precomputed hash value.

Parameters
keyThe item to search for and add.
hashThe precomputed hash.
Returns
The index of the item.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Add(), and Murl::IndexBase< KeyType, ArrayType, HashFunc >::Find().

Referenced by Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindAdd().

◆ FindAdd() [2/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindAdd ( const KeyType &  key)
inline

Find the first occurrence of a given item in the index, or add an item if the item was not found.

Parameters
keyThe item to search for and add.
Returns
The index of the item.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindAdd().

◆ FindPut() [1/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindPut ( const KeyType &  key,
const UInt32  hash 
)
inline

Find the first occurrence of a given item or add the item if the item was not found, using a precomputed hash value.

Hereby replacing an unlinked element if possible.

Parameters
keyThe item to search for and add.
hashThe precomputed hash.
Returns
The index of the item.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Find(), and Murl::IndexBase< KeyType, ArrayType, HashFunc >::Put().

Referenced by Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindPut().

◆ FindPut() [2/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindPut ( const KeyType &  key)
inline

Find the first occurrence of a given item or put the item if the item was not found.

Hereby replacing an unlinked element if possible.

Parameters
keyThe item to search for and add.
Returns
The index of the item.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindPut().

◆ Find() [1/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::Find ( const KeyType &  key,
const UInt32  hash 
) const
inline

◆ Find() [2/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::Find ( const KeyType &  key) const
inline

Find the first occurrence of a given item.

Parameters
keyThe item to search for.
Returns
The index of the item, or -1 if not found.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Find().

◆ FindNext()

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindNext ( SInt32  index) const
inline

Find the next occurrence of an item that is specified by a given index.

Parameters
indexThe index of the item containing the key to search for.
Returns
The index of the next item, or -1 if not found.

References Murl::Hash::FindNext().

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::FindNext(), and Murl::IndexBase< KeyType, ArrayType, HashFunc >::RemoveKey().

◆ FindPrev()

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindPrev ( SInt32  index) const
inline

Find the previous occurrence of an item that is specified by a given index.

Parameters
indexThe index of the item containing the key to search for.
Returns
The index of the previous item, or -1 if not found.

References Murl::Hash::FindPrev().

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::FindPrev().

◆ FindLast() [1/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindLast ( const KeyType &  key,
const UInt32  hash 
) const
inline

Find the last occurrence of a given item, using a precomputed hash value.

Parameters
keyThe item to search for.
hashThe precomputed hash value.
Returns
The index of the item, or -1 if not found.

References Murl::Hash::FindLast().

Referenced by Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindLast(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::FindLast().

◆ FindLast() [2/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindLast ( const KeyType &  key) const
inline

Find the last occurrence of a given item.

Parameters
keyThe item to search for.
Returns
The index of the item, or -1 if not found.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindLast().

◆ Insert() [1/2]

template<class KeyType , class ArrayType , class HashFunc >
KeyType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::Insert ( SInt32  index,
const KeyType &  key,
const UInt32  hash 
)
inline

Insert an item at a given position, using a precomputed hash value.

Parameters
indexThe index where to insert the item.
keyThe item to insert.
hashThe precomputed hash value.
Returns
A reference to the inserted item.

References Murl::Hash::Insert().

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Insert().

◆ Insert() [2/2]

template<class KeyType , class ArrayType , class HashFunc >
KeyType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::Insert ( SInt32  index,
const KeyType &  key 
)
inline

Insert an item at a given position.

Parameters
indexThe index where to insert the item.
keyThe item to insert.
Returns
A reference to the inserted item.

References Murl::Hash::Insert().

◆ Remove() [1/4]

template<class KeyType , class ArrayType , class HashFunc >
void Murl::IndexBase< KeyType, ArrayType, HashFunc >::Remove ( SInt32  index)
inline

◆ Remove() [2/4]

template<class KeyType , class ArrayType , class HashFunc >
void Murl::IndexBase< KeyType, ArrayType, HashFunc >::Remove ( SInt32  index,
SInt32  count 
)
inline

Remove a number of items at a given starting position.

Parameters
indexThe index from where to start removing the items.
countThe number of subsequent items to remove.

References Murl::Hash::Remove().

◆ Remove() [3/4]

template<class KeyType , class ArrayType , class HashFunc >
void Murl::IndexBase< KeyType, ArrayType, HashFunc >::Remove ( const SInt32 sortedIndices,
SInt32  count 
)
inline

Remove a number of items at given positions.

Parameters
sortedIndicesA pointer to sorted indices where to remove the items.
countThe number of items to remove, i.e. the number of indices.

References Murl::Hash::Remove().

◆ Remove() [4/4]

template<class KeyType , class ArrayType , class HashFunc >
void Murl::IndexBase< KeyType, ArrayType, HashFunc >::Remove ( const SInt32Array sortedIndices)
inline

Remove a number of items at given positions.

Parameters
sortedIndicesA sorted array of indices where to remove the items.

References Murl::Array< DataType >::GetCount(), and Murl::IndexBase< KeyType, ArrayType, HashFunc >::Remove().

◆ RemoveKey() [1/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::RemoveKey ( const KeyType &  key,
const UInt32  hash 
)
inline

Remove all items that match a given item, using a precomputed hash value.

Parameters
keyThe item to remove.
hashThe precomputed hash value.
Returns
The number of items that were removed.

References Murl::Array< DataType >::Add(), Murl::IndexBase< KeyType, ArrayType, HashFunc >::Find(), Murl::IndexBase< KeyType, ArrayType, HashFunc >::FindNext(), Murl::Array< DataType >::GetCount(), and Murl::IndexBase< KeyType, ArrayType, HashFunc >::Remove().

Referenced by Murl::IndexBase< KeyType, ArrayType, HashFunc >::RemoveKey().

◆ RemoveKey() [2/2]

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::RemoveKey ( const KeyType &  key)
inline

Remove all items that match a given item.

Parameters
keyThe item to remove.
Returns
The number of items that were removed.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::RemoveKey().

◆ Front()

template<class KeyType , class ArrayType , class HashFunc >
const KeyType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::Front ( ) const
inline

Get a reference to the first item.

Synonymous to Bottom().

Returns
A reference to the first item.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Bottom().

◆ Back()

template<class KeyType , class ArrayType , class HashFunc >
const KeyType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::Back ( ) const
inline

Get a reference to the last item.

Synonymous to Top().

Returns
A reference to the last item.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::Top().

◆ Bottom()

template<class KeyType , class ArrayType , class HashFunc >
const KeyType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::Bottom ( ) const
inline

Get a reference to the first item.

Returns
A reference to the first item.

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::BottomKey(), and Murl::IndexBase< KeyType, ArrayType, HashFunc >::Front().

◆ Top()

template<class KeyType , class ArrayType , class HashFunc >
const KeyType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::Top ( ) const
inline

Get a reference to the last item.

Returns
A reference to the last item.

Referenced by Murl::IndexBase< KeyType, ArrayType, HashFunc >::Back(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::TopKey().

◆ IsIndexValid()

template<class KeyType , class ArrayType , class HashFunc >
Bool Murl::IndexBase< KeyType, ArrayType, HashFunc >::IsIndexValid ( SInt32  index) const
inline

Check if a given index is a valid index.

Parameters
indexThe index to check.
Returns
true if index >= 0 and index < GetCount().

◆ operator[]()

template<class KeyType , class ArrayType , class HashFunc >
const KeyType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::operator[] ( SInt32  index) const
inline

Get a const reference to the item at a given index.

If the index is out of range, the behaviour is undefined.

Parameters
indexThe index of the item to retrieve.
Returns
A const reference to the requested item.

◆ Get()

template<class KeyType , class ArrayType , class HashFunc >
const KeyType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::Get ( SInt32  index) const
inline

Get a const reference to the item at a given index.

If the index is out of range, the behaviour is undefined.

Parameters
indexThe index of the item to retrieve.
Returns
A const reference to the requested item.

◆ GetAlloc()

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::GetAlloc ( ) const
inline

Get the number of actually allocated items.

Returns
The number of allocated items.

◆ GetCount()

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::GetCount ( ) const
inline

Get the number of items.

Returns
The number of items.

◆ IsEmpty()

template<class KeyType , class ArrayType , class HashFunc >
Bool Murl::IndexBase< KeyType, ArrayType, HashFunc >::IsEmpty ( ) const
inline

Check if the Index is empty.

Returns
true if the Index is empty, false otherwise.

◆ GetKeys()

template<class KeyType , class ArrayType , class HashFunc >
const ArrayType& Murl::IndexBase< KeyType, ArrayType, HashFunc >::GetKeys ( ) const
inline

Get a const reference to the array of items.

Returns
A const reference to the underlying item storage array.

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::GetKeys().

◆ Swap()

template<class KeyType , class ArrayType , class HashFunc >
void Murl::IndexBase< KeyType, ArrayType, HashFunc >::Swap ( IndexBase< KeyType, ArrayType, HashFunc > &  other)
inline

Exchange the content of the index object with a given second one.

Parameters
otherThe second index object.

References Murl::Hash::Swap().

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Swap().

◆ Begin()

template<class KeyType , class ArrayType , class HashFunc >
ConstIterator Murl::IndexBase< KeyType, ArrayType, HashFunc >::Begin ( ) const
inline

Get the const iterator to the first item.

Returns
The const iterator to the first item.

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::KeyBegin().

◆ End()

template<class KeyType , class ArrayType , class HashFunc >
ConstIterator Murl::IndexBase< KeyType, ArrayType, HashFunc >::End ( ) const
inline

Get the const iterator next to the last item.

Returns
The const iterator next to the last item.

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::KeyEnd().

◆ GetIter()

template<class KeyType , class ArrayType , class HashFunc >
ConstIterator Murl::IndexBase< KeyType, ArrayType, HashFunc >::GetIter ( SInt32  index) const
inline

Get the const iterator of a specified index.

Parameters
indexThe index for the iterator.
Returns
The const iterator or null if the index is out of range.

Referenced by Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::KeyGetIter().

◆ GetIterIndex()

template<class KeyType , class ArrayType , class HashFunc >
SInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::GetIterIndex ( ConstIterator  iterator) const
inline

Get the item index by iterator.

(!) Adding or removing items will invalidate iterators.

Parameters
iteratorThe iterator of the item.
Returns
The index of the item, or -1 if the iterator is invalid.

◆ CalculateHash()

template<class KeyType , class ArrayType , class HashFunc >
UInt32 Murl::IndexBase< KeyType, ArrayType, HashFunc >::CalculateHash ( const KeyType &  key) const
inline

◆ IsEqual()

template<class KeyType , class ArrayType , class HashFunc >
Bool Murl::IndexBase< KeyType, ArrayType, HashFunc >::IsEqual ( const IndexBase< KeyType, ArrayType, HashFunc > &  other) const
inline

Compare the index to another one.

Parameters
otherThe index to compare.
Returns
true if all keys have identical contents.

Referenced by Murl::IndexBase< KeyType, ArrayType, HashFunc >::operator!=(), and Murl::IndexBase< KeyType, ArrayType, HashFunc >::operator==().

◆ operator==()

template<class KeyType , class ArrayType , class HashFunc >
bool Murl::IndexBase< KeyType, ArrayType, HashFunc >::operator== ( const IndexBase< KeyType, ArrayType, HashFunc > &  rhs) const
inline

The "equal to" comparison operator, calls IsEqual().

Parameters
rhsThe right hand side index to compare.
Returns
true if all keys have identical contents.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::IsEqual().

◆ operator!=()

template<class KeyType , class ArrayType , class HashFunc >
bool Murl::IndexBase< KeyType, ArrayType, HashFunc >::operator!= ( const IndexBase< KeyType, ArrayType, HashFunc > &  rhs) const
inline

The "not equal to" comparison operator, calls IsEqual().

Parameters
rhsThe right hand side index to compare.
Returns
true if the indices differ.

References Murl::IndexBase< KeyType, ArrayType, HashFunc >::IsEqual().


The documentation for this class was generated from the following file:
  • murl_index_base.h


Copyright © 2011-2024 Spraylight GmbH.