EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dfe::FlatMap< Key, T, Compare > Class Template Reference

#include <acts/blob/sPHENIX/thirdparty/dfelibs/dfe/dfe_flat.hpp>

+ Collaboration diagram for dfe::FlatMap< Key, T, Compare >:

Classes

struct  KeyCompare
 
struct  KeyIndex
 

Public Types

using key_type = Key
 
using value_type = T
 
using size_type = std::size_t
 

Public Member Functions

value_typeat (const Key &key)
 Writable access to an element or throw if it does not exists.
 
const value_typeat (const Key &key) const
 Read-only access to an element or throw if it does not exists.
 
bool empty () const
 Return true if there are no elements in the map.
 
size_type size () const
 Return the number of elements in the container.
 
void clear ()
 Remove all elements from the container.
 
template<typename... Params>
void emplace (const Key &key, Params &&...params)
 
bool contains (const Key &key) const
 Return true if an element exists for the given key.
 

Private Attributes

FlatSet< KeyIndex, KeyComparem_keys
 
std::vector< Tm_items
 

Detailed Description

template<typename Key, typename T, typename Compare = std::less<Key>>
class dfe::FlatMap< Key, T, Compare >

A key-value map that stores keys and values in sequential containers.

Template Parameters
KeyStored element key type
TStored element value type
CompareFunction satisfying the Compare name requirements for keys

Supports access by key, clearing all elements, adding or replacing the stored value for a given key, and membership checks. Keys and values are stored in separate sequential containers to simplify allocation and benefit from greater memory locality.

Definition at line 105 of file dfe_flat.hpp.

View newest version in sPHENIX GitHub at line 105 of file dfe_flat.hpp

Member Typedef Documentation

template<typename Key , typename T , typename Compare = std::less<Key>>
using dfe::FlatMap< Key, T, Compare >::key_type = Key

Definition at line 107 of file dfe_flat.hpp.

View newest version in sPHENIX GitHub at line 107 of file dfe_flat.hpp

template<typename Key , typename T , typename Compare = std::less<Key>>
using dfe::FlatMap< Key, T, Compare >::size_type = std::size_t

Definition at line 109 of file dfe_flat.hpp.

View newest version in sPHENIX GitHub at line 109 of file dfe_flat.hpp

template<typename Key , typename T , typename Compare = std::less<Key>>
using dfe::FlatMap< Key, T, Compare >::value_type = T

Definition at line 108 of file dfe_flat.hpp.

View newest version in sPHENIX GitHub at line 108 of file dfe_flat.hpp

Member Function Documentation

template<typename Key , typename T , typename Compare = std::less<Key>>
value_type& dfe::FlatMap< Key, T, Compare >::at ( const Key &  key)
inline

Writable access to an element or throw if it does not exists.

Definition at line 112 of file dfe_flat.hpp.

View newest version in sPHENIX GitHub at line 112 of file dfe_flat.hpp

References dfe::FlatSet< T, Compare, Container >::at(), dfe::FlatMap< Key, T, Compare >::m_items, and dfe::FlatMap< Key, T, Compare >::m_keys.

+ Here is the call graph for this function:

template<typename Key , typename T , typename Compare = std::less<Key>>
const value_type& dfe::FlatMap< Key, T, Compare >::at ( const Key &  key) const
inline

Read-only access to an element or throw if it does not exists.

Definition at line 114 of file dfe_flat.hpp.

View newest version in sPHENIX GitHub at line 114 of file dfe_flat.hpp

References dfe::FlatSet< T, Compare, Container >::at(), dfe::FlatMap< Key, T, Compare >::m_items, and dfe::FlatMap< Key, T, Compare >::m_keys.

+ Here is the call graph for this function:

template<typename Key , typename T , typename Compare = std::less<Key>>
void dfe::FlatMap< Key, T, Compare >::clear ( )
inline

Remove all elements from the container.

Definition at line 124 of file dfe_flat.hpp.

View newest version in sPHENIX GitHub at line 124 of file dfe_flat.hpp

References dfe::FlatSet< T, Compare, Container >::clear(), dfe::FlatMap< Key, T, Compare >::m_items, and dfe::FlatMap< Key, T, Compare >::m_keys.

+ Here is the call graph for this function:

template<typename Key , typename T , typename Compare = std::less<Key>>
bool dfe::FlatMap< Key, T, Compare >::contains ( const Key &  key) const
inline

Return true if an element exists for the given key.

Definition at line 133 of file dfe_flat.hpp.

View newest version in sPHENIX GitHub at line 133 of file dfe_flat.hpp

References dfe::FlatSet< T, Compare, Container >::contains(), and dfe::FlatMap< Key, T, Compare >::m_keys.

+ Here is the call graph for this function:

template<typename Key , typename T , typename Compare >
template<typename... Params>
void dfe::FlatMap< Key, T, Compare >::emplace ( const Key &  key,
Params &&...  params 
)
inline

Add the element under the given key or replace an existing element.

New elements are constructed or assigned in-place with the parameters forwarded to a T(...) constructor call.

Definition at line 203 of file dfe_flat.hpp.

View newest version in sPHENIX GitHub at line 203 of file dfe_flat.hpp

References T.

template<typename Key , typename T , typename Compare = std::less<Key>>
bool dfe::FlatMap< Key, T, Compare >::empty ( ) const
inline

Return true if there are no elements in the map.

Definition at line 119 of file dfe_flat.hpp.

View newest version in sPHENIX GitHub at line 119 of file dfe_flat.hpp

References dfe::FlatSet< T, Compare, Container >::empty(), and dfe::FlatMap< Key, T, Compare >::m_keys.

+ Here is the call graph for this function:

template<typename Key , typename T , typename Compare = std::less<Key>>
size_type dfe::FlatMap< Key, T, Compare >::size ( ) const
inline

Return the number of elements in the container.

Definition at line 121 of file dfe_flat.hpp.

View newest version in sPHENIX GitHub at line 121 of file dfe_flat.hpp

References dfe::FlatMap< Key, T, Compare >::m_keys, and dfe::FlatSet< T, Compare, Container >::size().

+ Here is the call graph for this function:

Member Data Documentation

template<typename Key , typename T , typename Compare = std::less<Key>>
std::vector<T> dfe::FlatMap< Key, T, Compare >::m_items
private

Definition at line 153 of file dfe_flat.hpp.

View newest version in sPHENIX GitHub at line 153 of file dfe_flat.hpp

Referenced by dfe::FlatMap< Key, T, Compare >::at(), and dfe::FlatMap< Key, T, Compare >::clear().

template<typename Key , typename T , typename Compare = std::less<Key>>
FlatSet<KeyIndex, KeyCompare> dfe::FlatMap< Key, T, Compare >::m_keys
private

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