Project
Loading...
Searching...
No Matches
o2::dataformats::LabelContainer< LabelType, isContiguousStorage > Class Template Reference

#include <LabelContainer.h>

Classes

struct  HeaderElementContinuous
 
struct  HeaderElementLinked
 
class  Iterator
 
class  LabelView
 

Public Types

using HeaderElement = typename std::conditional< isContiguousStorage, HeaderElementContinuous, HeaderElementLinked >::type
 
using StoredLabelType = typename std::conditional< isContiguousStorage, LabelType, std::pair< LabelType, int > >::type
 

Public Member Functions

 LabelContainer ()=default
 
 ~LabelContainer ()=default
 
void reserve (int n)
 
void clear ()
 
void addLabel (unsigned int dataindex, LabelType const &label)
 add a label for a dataindex
 
LabelView getLabels (int dataindex)
 get a container view on labels allowing use standard forward iteration in user code
 
void fillVectorOfLabels (int dataindex, std::vector< LabelType > &v)
 

Static Public Member Functions

static unsigned int getNextIndex (unsigned int index, std::vector< LabelType > const &)
 
static unsigned int getNextIndex (unsigned int index, std::vector< std::pair< LabelType, int > > const &labels)
 
static LabelType & dereference (std::vector< LabelType > &v, int index)
 
static LabelType & dereference (std::vector< std::pair< LabelType, int > > &v, int index)
 
static int lastIndex (HeaderElementContinuous const &h)
 
static int lastIndex (HeaderElementLinked const &h)
 
static void addLabelImpl (int dataindex, std::vector< HeaderElementContinuous > &headerv, std::vector< LabelType > &labelv, LabelType const &label)
 
static void addLabelImpl (int dataindex, std::vector< HeaderElementLinked > &headerv, std::vector< std::pair< LabelType, int > > &labelv, LabelType const &label)
 

Public Attributes

std::vector< HeaderElementmHeaderArray
 
std::vector< StoredLabelTypemLabelArray
 

Detailed Description

template<typename LabelType, bool isContiguousStorage = true>
class o2::dataformats::LabelContainer< LabelType, isContiguousStorage >

Definition at line 35 of file LabelContainer.h.

Member Typedef Documentation

◆ HeaderElement

template<typename LabelType , bool isContiguousStorage = true>
using o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::HeaderElement = typename std::conditional<isContiguousStorage, HeaderElementContinuous, HeaderElementLinked>::type

Definition at line 55 of file LabelContainer.h.

◆ StoredLabelType

template<typename LabelType , bool isContiguousStorage = true>
using o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::StoredLabelType = typename std::conditional<isContiguousStorage, LabelType, std::pair<LabelType, int> >::type

Definition at line 56 of file LabelContainer.h.

Constructor & Destructor Documentation

◆ LabelContainer()

template<typename LabelType , bool isContiguousStorage = true>
o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::LabelContainer ( )
default

◆ ~LabelContainer()

template<typename LabelType , bool isContiguousStorage = true>
o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::~LabelContainer ( )
default

Member Function Documentation

◆ addLabel()

template<typename LabelType , bool isContiguousStorage = true>
void o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::addLabel ( unsigned int  dataindex,
LabelType const &  label 
)
inline

add a label for a dataindex

Definition at line 209 of file LabelContainer.h.

◆ addLabelImpl() [1/2]

template<typename LabelType , bool isContiguousStorage = true>
static void o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::addLabelImpl ( int  dataindex,
std::vector< HeaderElementContinuous > &  headerv,
std::vector< LabelType > &  labelv,
LabelType const &  label 
)
inlinestatic

Definition at line 145 of file LabelContainer.h.

◆ addLabelImpl() [2/2]

template<typename LabelType , bool isContiguousStorage = true>
static void o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::addLabelImpl ( int  dataindex,
std::vector< HeaderElementLinked > &  headerv,
std::vector< std::pair< LabelType, int > > &  labelv,
LabelType const &  label 
)
inlinestatic

Definition at line 163 of file LabelContainer.h.

◆ clear()

template<typename LabelType , bool isContiguousStorage = true>
void o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::clear ( )
inline

Definition at line 202 of file LabelContainer.h.

◆ dereference() [1/2]

template<typename LabelType , bool isContiguousStorage = true>
static LabelType & o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::dereference ( std::vector< LabelType > &  v,
int  index 
)
inlinestatic

Definition at line 67 of file LabelContainer.h.

◆ dereference() [2/2]

template<typename LabelType , bool isContiguousStorage = true>
static LabelType & o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::dereference ( std::vector< std::pair< LabelType, int > > &  v,
int  index 
)
inlinestatic

Definition at line 71 of file LabelContainer.h.

◆ fillVectorOfLabels()

template<typename LabelType , bool isContiguousStorage = true>
void o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::fillVectorOfLabels ( int  dataindex,
std::vector< LabelType > &  v 
)
inline

fill an external vector container with labels might be useful to perform additional operations such as sorting on the labels; the external vector can be reused to avoid allocations/deallocs)

fixme: provide a template specialized fast version for contiguous storage

Definition at line 221 of file LabelContainer.h.

◆ getLabels()

template<typename LabelType , bool isContiguousStorage = true>
LabelView o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::getLabels ( int  dataindex)
inline

get a container view on labels allowing use standard forward iteration in user code

Definition at line 216 of file LabelContainer.h.

◆ getNextIndex() [1/2]

template<typename LabelType , bool isContiguousStorage = true>
static unsigned int o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::getNextIndex ( unsigned int  index,
std::vector< LabelType > const &   
)
inlinestatic

Definition at line 59 of file LabelContainer.h.

◆ getNextIndex() [2/2]

template<typename LabelType , bool isContiguousStorage = true>
static unsigned int o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::getNextIndex ( unsigned int  index,
std::vector< std::pair< LabelType, int > > const &  labels 
)
inlinestatic

Definition at line 63 of file LabelContainer.h.

◆ lastIndex() [1/2]

template<typename LabelType , bool isContiguousStorage = true>
static int o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::lastIndex ( HeaderElementContinuous const &  h)
inlinestatic

Definition at line 75 of file LabelContainer.h.

◆ lastIndex() [2/2]

template<typename LabelType , bool isContiguousStorage = true>
static int o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::lastIndex ( HeaderElementLinked const &  h)
inlinestatic

Definition at line 79 of file LabelContainer.h.

◆ reserve()

template<typename LabelType , bool isContiguousStorage = true>
void o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::reserve ( int  n)
inline

Definition at line 196 of file LabelContainer.h.

Member Data Documentation

◆ mHeaderArray

template<typename LabelType , bool isContiguousStorage = true>
std::vector<HeaderElement> o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::mHeaderArray

Definition at line 186 of file LabelContainer.h.

◆ mLabelArray

template<typename LabelType , bool isContiguousStorage = true>
std::vector<StoredLabelType> o2::dataformats::LabelContainer< LabelType, isContiguousStorage >::mLabelArray

Definition at line 187 of file LabelContainer.h.


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