ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Acts::MultiIndex< T, BitsPerLevel > Class Template Reference

#include <acts/blob/master/Core/include/Acts/Utilities/MultiIndex.hpp>

+ Collaboration diagram for Acts::MultiIndex< T, BitsPerLevel >:

Public Types

enum  { NumLevels = sizeof...(BitsPerLevel) }
 
using Value = T
 The type of ther underlying storage value.
 

Public Member Functions

constexpr MultiIndex (Value encoded)
 Construct a MultiIndex from an already encoded value.
 
 MultiIndex ()=default
 Construct a default MultiIndex with undefined values for each level.
 
 MultiIndex (const MultiIndex &)=default
 
 MultiIndex (MultiIndex &)=default
 
MultiIndexoperator= (const MultiIndex &)=default
 
MultiIndexoperator= (MultiIndex &&)=default
 
constexpr MultiIndexoperator= (Value encoded)
 Allow setting the MultiIndex from an already encoded value.
 
constexpr Value value () const
 Get the encoded value of all index levels.
 
constexpr Value level (std::size_t lvl) const
 Get the value for the index level.
 
constexpr MultiIndexset (std::size_t lvl, Value val)
 Set the value of the index level.
 
constexpr MultiIndex makeNextSibling (std::size_t lvl) const
 Create index with the selected level increased and levels below zeroed.
 
constexpr MultiIndex makeLastDescendant (std::size_t lvl) const
 Create index with every level below the selected level maximized.
 

Static Public Member Functions

static constexpr MultiIndex Zeros ()
 Construct a MultiIndex with all levels set to zero.
 
template<typename... Us>
static constexpr MultiIndex Encode (Us &&...us)
 

Static Private Member Functions

static constexpr std::size_t shift (std::size_t lvl)
 
static constexpr Value mask (std::size_t lvl)
 

Private Attributes

Value m_value
 

Static Private Attributes

static constexpr std::array
< std::size_t, NumLevels
s_bits {BitsPerLevel...}
 

Friends

constexpr bool operator< (MultiIndex lhs, MultiIndex rhs)
 
constexpr bool operator== (MultiIndex lhs, MultiIndex rhs)
 
std::ostream & operator<< (std::ostream &os, MultiIndex idx)
 

Detailed Description

template<typename T, std::size_t... BitsPerLevel>
class Acts::MultiIndex< T, BitsPerLevel >

A set of (hierachical) indices bitpacked into a single value.

The underlying value is split into blocks of bits with variable size. Each block is a level within the index hierachy and can be set and retrieved separately. The encoded MultiIndex can be ordered and compared for equality. The ordering follows the hiearchy, i.e. indices are first ordered by the highest level, then within the highest level by the second level and so on.

Definition at line 29 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 29 of file MultiIndex.hpp

Member Typedef Documentation

template<typename T, std::size_t... BitsPerLevel>
using Acts::MultiIndex< T, BitsPerLevel >::Value = T

The type of ther underlying storage value.

Definition at line 39 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 39 of file MultiIndex.hpp

Member Enumeration Documentation

template<typename T, std::size_t... BitsPerLevel>
anonymous enum
Enumerator:
NumLevels 

Definition at line 40 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 40 of file MultiIndex.hpp

Constructor & Destructor Documentation

template<typename T, std::size_t... BitsPerLevel>
constexpr Acts::MultiIndex< T, BitsPerLevel >::MultiIndex ( Value  encoded)
inline

Construct a MultiIndex from an already encoded value.

Definition at line 67 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 67 of file MultiIndex.hpp

template<typename T, std::size_t... BitsPerLevel>
Acts::MultiIndex< T, BitsPerLevel >::MultiIndex ( )
default

Construct a default MultiIndex with undefined values for each level.

Referenced by Acts::MultiIndex< uint64_t, 12, 12, 16, 8, 16 >::Zeros().

+ Here is the caller graph for this function:

template<typename T, std::size_t... BitsPerLevel>
Acts::MultiIndex< T, BitsPerLevel >::MultiIndex ( const MultiIndex< T, BitsPerLevel > &  )
default
template<typename T, std::size_t... BitsPerLevel>
Acts::MultiIndex< T, BitsPerLevel >::MultiIndex ( MultiIndex< T, BitsPerLevel > &  )
default

Member Function Documentation

template<typename T, std::size_t... BitsPerLevel>
template<typename... Us>
static constexpr MultiIndex Acts::MultiIndex< T, BitsPerLevel >::Encode ( Us &&...  us)
inlinestatic

Construct a MultiIndex from values for multiple level.

This functionality must be implemented as a static, named constructor to avoid confusion with other constructors. If it would be implemented as a regular constructor, constructing a MultiIndex from a single encoded value and encoding only the first level would have the same signature and could not be distinguished.

Definition at line 54 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 54 of file MultiIndex.hpp

Referenced by BOOST_AUTO_TEST_CASE().

+ Here is the caller graph for this function:

template<typename T, std::size_t... BitsPerLevel>
constexpr Value Acts::MultiIndex< T, BitsPerLevel >::level ( std::size_t  lvl) const
inline

Get the value for the index level.

Definition at line 83 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 83 of file MultiIndex.hpp

Referenced by BOOST_AUTO_TEST_CASE().

+ Here is the caller graph for this function:

template<typename T, std::size_t... BitsPerLevel>
constexpr MultiIndex Acts::MultiIndex< T, BitsPerLevel >::makeLastDescendant ( std::size_t  lvl) const
inline

Create index with every level below the selected level maximized.

Definition at line 108 of file MultiIndex.hpp.

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

template<typename T, std::size_t... BitsPerLevel>
constexpr MultiIndex Acts::MultiIndex< T, BitsPerLevel >::makeNextSibling ( std::size_t  lvl) const
inline

Create index with the selected level increased and levels below zeroed.

Definition at line 100 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 100 of file MultiIndex.hpp

template<typename T, std::size_t... BitsPerLevel>
static constexpr Value Acts::MultiIndex< T, BitsPerLevel >::mask ( std::size_t  lvl)
inlinestaticprivate

Definition at line 127 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 127 of file MultiIndex.hpp

Referenced by Acts::MultiIndex< uint64_t, 12, 12, 16, 8, 16 >::level(), and Acts::MultiIndex< uint64_t, 12, 12, 16, 8, 16 >::set().

+ Here is the caller graph for this function:

template<typename T, std::size_t... BitsPerLevel>
MultiIndex& Acts::MultiIndex< T, BitsPerLevel >::operator= ( const MultiIndex< T, BitsPerLevel > &  )
default
template<typename T, std::size_t... BitsPerLevel>
MultiIndex& Acts::MultiIndex< T, BitsPerLevel >::operator= ( MultiIndex< T, BitsPerLevel > &&  )
default
template<typename T, std::size_t... BitsPerLevel>
constexpr MultiIndex& Acts::MultiIndex< T, BitsPerLevel >::operator= ( Value  encoded)
inline

Allow setting the MultiIndex from an already encoded value.

Definition at line 75 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 75 of file MultiIndex.hpp

template<typename T, std::size_t... BitsPerLevel>
constexpr MultiIndex& Acts::MultiIndex< T, BitsPerLevel >::set ( std::size_t  lvl,
Value  val 
)
inline

Set the value of the index level.

Definition at line 88 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 88 of file MultiIndex.hpp

Referenced by BOOST_AUTO_TEST_CASE(), and Acts::MultiIndex< uint64_t, 12, 12, 16, 8, 16 >::Encode().

+ Here is the caller graph for this function:

template<typename T, std::size_t... BitsPerLevel>
static constexpr std::size_t Acts::MultiIndex< T, BitsPerLevel >::shift ( std::size_t  lvl)
inlinestaticprivate

Definition at line 119 of file MultiIndex.hpp.

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

Referenced by Acts::MultiIndex< uint64_t, 12, 12, 16, 8, 16 >::level(), Acts::MultiIndex< uint64_t, 12, 12, 16, 8, 16 >::makeLastDescendant(), Acts::MultiIndex< uint64_t, 12, 12, 16, 8, 16 >::makeNextSibling(), and Acts::MultiIndex< uint64_t, 12, 12, 16, 8, 16 >::set().

+ Here is the caller graph for this function:

template<typename T, std::size_t... BitsPerLevel>
constexpr Value Acts::MultiIndex< T, BitsPerLevel >::value ( ) const
inline

Get the encoded value of all index levels.

Definition at line 81 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 81 of file MultiIndex.hpp

Referenced by BOOST_AUTO_TEST_CASE().

+ Here is the caller graph for this function:

template<typename T, std::size_t... BitsPerLevel>
static constexpr MultiIndex Acts::MultiIndex< T, BitsPerLevel >::Zeros ( )
inlinestatic

Construct a MultiIndex with all levels set to zero.

Definition at line 45 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 45 of file MultiIndex.hpp

Referenced by BOOST_AUTO_TEST_CASE().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

template<typename T, std::size_t... BitsPerLevel>
constexpr bool operator< ( MultiIndex< T, BitsPerLevel >  lhs,
MultiIndex< T, BitsPerLevel >  rhs 
)
friend

Definition at line 133 of file MultiIndex.hpp.

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

template<typename T, std::size_t... BitsPerLevel>
std::ostream& operator<< ( std::ostream &  os,
MultiIndex< T, BitsPerLevel >  idx 
)
friend

Definition at line 139 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 139 of file MultiIndex.hpp

template<typename T, std::size_t... BitsPerLevel>
constexpr bool operator== ( MultiIndex< T, BitsPerLevel >  lhs,
MultiIndex< T, BitsPerLevel >  rhs 
)
friend

Definition at line 136 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 136 of file MultiIndex.hpp

Member Data Documentation

template<typename T, std::size_t... BitsPerLevel>
constexpr std::array<std::size_t, NumLevels> Acts::MultiIndex< T, BitsPerLevel >::s_bits {BitsPerLevel...}
staticprivate

Definition at line 118 of file MultiIndex.hpp.

View newest version in sPHENIX GitHub at line 118 of file MultiIndex.hpp

Referenced by Acts::MultiIndex< uint64_t, 12, 12, 16, 8, 16 >::mask(), and Acts::MultiIndex< uint64_t, 12, 12, 16, 8, 16 >::shift().


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