Loading...
Searching...
No Matches
meshkit::detail::MultiMap< K, V > Class Template Reference

Multi-valued hash map with the QMultiHash subset the CDT kernel uses. More...

#include <meshkit/detail/storage.hpp>

Collaboration diagram for meshkit::detail::MultiMap< K, V >:

Public Member Functions

void clear ()
 Remove all keys and values.
 
void remove (const K &key)
 Remove every value stored under key.
 
void insert (const K &key, const V &value)
 Add value under key, ahead of the values already there.
 
bool contains (const K &key, const V &value) const
 Key/value lookup by linear search of the key's values.
 
Vector< V > values (const K &key) const
 Copy of the values under key, most recently inserted first.
 

Detailed Description

template<class K, class V>
class meshkit::detail::MultiMap< K, V >

Multi-valued hash map with the QMultiHash subset the CDT kernel uses.

Each key holds a Vector<V> of values, newest first: insert() puts the value at the front and keeps duplicates. insert() and contains() are linear in the number of values under the key. There is no iteration interface and no internal synchronization.

Template Parameters
KKey type, hashed by Hash<K>.
VValue type; contains() compares values with operator==.

Member Function Documentation

◆ clear()

template<class K, class V>
void meshkit::detail::MultiMap< K, V >::clear ( )
inline

Remove all keys and values.

◆ contains()

template<class K, class V>
bool meshkit::detail::MultiMap< K, V >::contains ( const K & key,
const V & value ) const
inline

Key/value lookup by linear search of the key's values.

Parameters
[in]keyKey.
[in]valueValue to look for.
Returns
True when key holds a value equal to value.

◆ insert()

template<class K, class V>
void meshkit::detail::MultiMap< K, V >::insert ( const K & key,
const V & value )
inline

Add value under key, ahead of the values already there.

Parameters
[in]keyKey.
[in]valueValue to copy; duplicates are kept.
Here is the call graph for this function:

◆ remove()

template<class K, class V>
void meshkit::detail::MultiMap< K, V >::remove ( const K & key)
inline

Remove every value stored under key.

Parameters
[in]keyKey; an absent key is ignored.

◆ values()

template<class K, class V>
Vector< V > meshkit::detail::MultiMap< K, V >::values ( const K & key) const
inline

Copy of the values under key, most recently inserted first.

Parameters
[in]keyKey.
Returns
The values, or an empty vector when key is absent.
Here is the caller graph for this function:

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