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

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

+ Collaboration diagram for dfe::FlatSet< T, Compare, Container >:

Public Types

using value_type = T
 
using size_type = typename Container::size_type
 
using const_iterator = typename Container::const_iterator
 

Public Member Functions

template<typename U >
const value_typeat (U &&u) const
 Access the equivalent element or throw if it does not exists.
 
const_iterator begin () const
 
const_iterator end () const
 
bool empty () const
 Return true if there are no elements in the set.
 
size_type size () const
 Return the number of elements in the set.
 
void clear ()
 Remove all elements from the container.
 
void insert_or_assign (const T &t)
 
template<typename U >
const_iterator find (U &&u) const
 Return an interator to the equivalent element or .end() if not found.
 
template<typename U >
bool contains (U &&u) const
 Return true if the equivalent element is in the set.
 

Private Attributes

Container m_items
 

Detailed Description

template<typename T, typename Compare = std::less<T>, typename Container = std::vector<T>>
class dfe::FlatSet< T, Compare, Container >

An container adaptor to store a set of elements in a sequential container.

Template Parameters
TStored element type
CompareFunction satisfying the Compare named requirement
ContainerSequential container

Supports access by equivalence, iteration over all elements, removing all elements, adding elements while maintaining uniqueness, and membership checks. By using a sequential container, memory allocation is greatly simplified and lookups benefit from higher memory locality at the expense of slower insertion of elements. Should work best for smaller sets with frequent lookups.

The set elements can not be modified on purpose. With a non-standard Compare function modifying a contained object might change its identity and thus its position in the set. This would break the internal sorting.

Definition at line 55 of file dfe_flat.hpp.

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

Member Typedef Documentation

template<typename T, typename Compare = std::less<T>, typename Container = std::vector<T>>
using dfe::FlatSet< T, Compare, Container >::const_iterator = typename Container::const_iterator

Definition at line 59 of file dfe_flat.hpp.

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

template<typename T, typename Compare = std::less<T>, typename Container = std::vector<T>>
using dfe::FlatSet< T, Compare, Container >::size_type = typename Container::size_type

Definition at line 58 of file dfe_flat.hpp.

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

template<typename T, typename Compare = std::less<T>, typename Container = std::vector<T>>
using dfe::FlatSet< T, Compare, Container >::value_type = T

Definition at line 57 of file dfe_flat.hpp.

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

Member Function Documentation

template<typename T , typename Compare , typename Container >
template<typename U >
const FlatSet< T, Compare, Container >::value_type & dfe::FlatSet< T, Compare, Container >::at ( U &&  u) const
inline

Access the equivalent element or throw if it does not exists.

Definition at line 161 of file dfe_flat.hpp.

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

References pos(), and Acts::UnitConstants::u.

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T, typename Compare = std::less<T>, typename Container = std::vector<T>>
const_iterator dfe::FlatSet< T, Compare, Container >::begin ( ) const
inline

Definition at line 65 of file dfe_flat.hpp.

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

template<typename T, typename Compare = std::less<T>, typename Container = std::vector<T>>
void dfe::FlatSet< T, Compare, Container >::clear ( )
inline

Remove all elements from the container.

Definition at line 74 of file dfe_flat.hpp.

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

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

+ Here is the caller graph for this function:

template<typename T , typename Compare , typename Container >
template<typename U >
bool dfe::FlatSet< T, Compare, Container >::contains ( U &&  u) const
inline

Return true if the equivalent element is in the set.

Definition at line 193 of file dfe_flat.hpp.

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

References Acts::UnitConstants::u.

Referenced by dfe::FlatMap< Key, T, Compare >::contains().

+ Here is the caller graph for this function:

template<typename T, typename Compare = std::less<T>, typename Container = std::vector<T>>
bool dfe::FlatSet< T, Compare, Container >::empty ( ) const
inline

Return true if there are no elements in the set.

Definition at line 69 of file dfe_flat.hpp.

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

Referenced by dfe::FlatMap< Key, T, Compare >::empty().

+ Here is the caller graph for this function:

template<typename T, typename Compare = std::less<T>, typename Container = std::vector<T>>
const_iterator dfe::FlatSet< T, Compare, Container >::end ( ) const
inline

Definition at line 66 of file dfe_flat.hpp.

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

template<typename T , typename Compare , typename Container >
template<typename U >
FlatSet< T, Compare, Container >::const_iterator dfe::FlatSet< T, Compare, Container >::find ( U &&  u) const
inline

Return an interator to the equivalent element or .end() if not found.

Definition at line 183 of file dfe_flat.hpp.

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

References pos(), and Acts::UnitConstants::u.

+ Here is the call graph for this function:

template<typename T, typename Compare , typename Container >
void dfe::FlatSet< T, Compare, Container >::insert_or_assign ( const T t)
inline

Add the element to the set or replace the existing equivalent element.

Depending on the Compare function we might have elements with different values but the same identity with respect to the chosen Compare function. Only one can be kept and this function replaces the existing element with the new one in such a case.

Definition at line 171 of file dfe_flat.hpp.

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

References pos(), and t.

+ Here is the call graph for this function:

template<typename T, typename Compare = std::less<T>, typename Container = std::vector<T>>
size_type dfe::FlatSet< T, Compare, Container >::size ( ) const
inline

Return the number of elements in the set.

Definition at line 71 of file dfe_flat.hpp.

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

Referenced by dfe::FlatMap< Key, T, Compare >::size().

+ Here is the caller graph for this function:

Member Data Documentation

template<typename T, typename Compare = std::less<T>, typename Container = std::vector<T>>
Container dfe::FlatSet< T, Compare, Container >::m_items
private

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