AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::FlatMapView< KeyType, ValueType, IsConst, Hash > Class Template Reference

Forward declaration of FlatMapView. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/core/FlatMapView.hpp>

Inheritance diagram for axom::FlatMapView< KeyType, ValueType, IsConst, Hash >:

Classes

class  IteratorImpl
 

Public Types

using key_type = KeyType
 
using mapped_type = ValueType
 
using size_type = IndexType
 
using value_type = KeyValuePair
 
using iterator = IteratorImpl
 
using const_iterator = IteratorImpl
 
using FlatMapType = std::conditional_t< IsConst, const FlatMap< KeyType, ValueType, Hash >, FlatMap< KeyType, ValueType, Hash > >
 

Public Member Functions

 FlatMapView ()=default
 
 FlatMapView (FlatMapType &other)
 
bool empty () const
 Returns true if there are no entries in the FlatMap, false otherwise. More...
 
IndexType size () const
 Returns the number of entries stored in the FlatMap. More...
 
IndexType count (const KeyType &key) const
 Return the number of entries matching a given key. More...
 
bool contains (const KeyType &key) const
 Return true if the FlatMap contains a key, false otherwise. More...
 
AXOM_HOST_DEVICE IndexType bucket_count () const
 Returns the number of buckets allocated in the FlatMap. More...
 
AXOM_HOST_DEVICE const_iterator begin () const
 Returns an iterator to the first valid object in the bucket array. More...
 
AXOM_HOST_DEVICE const_iterator cbegin () const
 
AXOM_HOST_DEVICE const_iterator end () const
 Returns an iterator to "one past" the last valid object in the bucket array. More...
 
AXOM_HOST_DEVICE const_iterator cend () const
 
AXOM_HOST_DEVICE const_iterator find (const KeyType &key) const
 Try to find an entry with a given key. More...
 
AXOM_HOST_DEVICE const ValueType & operator[] (const KeyType &key) const
 Find an entry with a given key. More...
 

Friends

class IteratorImpl
 

Detailed Description

template<typename KeyType, typename ValueType, bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
class axom::FlatMapView< KeyType, ValueType, IsConst, Hash >

Forward declaration of FlatMapView.

Provides a read-only view of a key-value container.

See also
FlatMap

Member Typedef Documentation

◆ key_type

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
using axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::key_type = KeyType

◆ mapped_type

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
using axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::mapped_type = ValueType

◆ size_type

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
using axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::size_type = IndexType

◆ value_type

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
using axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::value_type = KeyValuePair

◆ iterator

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
using axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::iterator = IteratorImpl

◆ const_iterator

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
using axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::const_iterator = IteratorImpl

◆ FlatMapType

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
using axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::FlatMapType = std::conditional_t<IsConst, const FlatMap<KeyType, ValueType, Hash>, FlatMap<KeyType, ValueType, Hash> >

Constructor & Destructor Documentation

◆ FlatMapView() [1/2]

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::FlatMapView ( )
default

◆ FlatMapView() [2/2]

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::FlatMapView ( FlatMapType other)
inline

Member Function Documentation

◆ begin()

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
AXOM_HOST_DEVICE const_iterator axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::begin ( ) const
inline

Returns an iterator to the first valid object in the bucket array.

◆ cbegin()

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
AXOM_HOST_DEVICE const_iterator axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::cbegin ( ) const
inline

◆ end()

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
AXOM_HOST_DEVICE const_iterator axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::end ( ) const
inline

Returns an iterator to "one past" the last valid object in the bucket array.

References axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::bucket_count().

◆ cend()

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
AXOM_HOST_DEVICE const_iterator axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::cend ( ) const
inline

◆ find()

template<typename KeyType , typename ValueType , bool IsConst, typename Hash >
AXOM_HOST_DEVICE auto axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::find ( const KeyType &  key) const

Try to find an entry with a given key.

Parameters
[in]keythe key to search for
Returns
An iterator pointing to the corresponding key-value pair, or end() if the key wasn't found.

References axom::utilities::annotations::end().

◆ operator[]()

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
AXOM_HOST_DEVICE const ValueType& axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::operator[] ( const KeyType &  key) const
inline

Find an entry with a given key.

If a corresponding value does not exist, a default value for the value type will be returned (but not inserted into the map).

Parameters
[in]keythe key to search for
Returns
The corresponding value, or a default value if the key does not exist
Precondition
ValueType is default-constructible

References axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::end(), and axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::find().

◆ empty()

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
bool axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::empty ( ) const
inline

Returns true if there are no entries in the FlatMap, false otherwise.

◆ size()

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
IndexType axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::size ( ) const
inline

Returns the number of entries stored in the FlatMap.

◆ count()

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
IndexType axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::count ( const KeyType &  key) const
inline

Return the number of entries matching a given key.

This method will always return 0 or 1.

Parameters
[in]keythe key to search for

References axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::contains().

◆ contains()

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
bool axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::contains ( const KeyType &  key) const
inline

Return true if the FlatMap contains a key, false otherwise.

Parameters
[in]keythe key to search for

References axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::end(), and axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::find().

◆ bucket_count()

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
AXOM_HOST_DEVICE IndexType axom::FlatMapView< KeyType, ValueType, IsConst, Hash >::bucket_count ( ) const
inline

Returns the number of buckets allocated in the FlatMap.

The maximum number of elements that can be stored in the FlatMap without resizing and rehashing is bucket_count() * max_load_factor().

References axom::ArrayView< T, DIM, SPACE >::size().

Friends And Related Function Documentation

◆ IteratorImpl

template<typename KeyType , typename ValueType , bool IsConst, typename Hash = detail::flat_map::HashMixer64<KeyType, DeviceHash>>
friend class IteratorImpl
friend

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