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

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

+ Collaboration diagram for dfe::SmallVector< T, N, Allocator >:

Classes

struct  AllocatedStorage
 

Public Types

using value_type = T
 
using size_type = std::size_t
 
using iterator = T *
 
using const_iterator = const T *
 

Public Member Functions

 SmallVector ()=default
 
 ~SmallVector ()
 
value_typeoperator[] (size_type idx)
 
const value_typeoperator[] (size_type idx) const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
bool empty () const
 Return true if there are no elements in the vector.
 
size_type size () const
 Return the number of elements in the vector.
 
size_type capacity () const
 Return the number of elements that can be stored in the available memory.
 
void clear ()
 
template<typename... Args>
iterator emplace (const_iterator pos, Args &&...args)
 Construct an element directly before the given position in the vector.
 
template<typename... Args>
Templace_back (Args &&...args)
 Construct an element at the back of the vector and return its reference.
 

Private Member Functions

AllocatedStorage allocate_storage (size_type capacity)
 
void destruct_inplace ()
 
void destruct_deallocate_onheap ()
 

Private Attributes

size_type m_size = 0
 
union {
   AllocatedStorage   m_onheap
 
}; 
 
Allocator m_alloc
 

Detailed Description

template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
class dfe::SmallVector< T, N, Allocator >

An continous container that stores some elements in-place.

Template Parameters
TStored element type
NMaximum number of elements stored in-place.
AllocatorAllocator for elements of type T

If the vector contains less or equal than N elements, they are stored in the vector itself without the need to allocate additional memory.

Supports access by index, iteration over elements, deleting all existing elements from the vector, and adding elements at a specified location or at the back.

Definition at line 47 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 47 of file dfe_smallvector.hpp

Member Typedef Documentation

template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
using dfe::SmallVector< T, N, Allocator >::const_iterator = const T*

Definition at line 52 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 52 of file dfe_smallvector.hpp

template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
using dfe::SmallVector< T, N, Allocator >::iterator = T*

Definition at line 51 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 51 of file dfe_smallvector.hpp

template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
using dfe::SmallVector< T, N, Allocator >::size_type = std::size_t

Definition at line 50 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 50 of file dfe_smallvector.hpp

template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
using dfe::SmallVector< T, N, Allocator >::value_type = T

Definition at line 49 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 49 of file dfe_smallvector.hpp

Constructor & Destructor Documentation

template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
dfe::SmallVector< T, N, Allocator >::SmallVector ( )
default
template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
dfe::SmallVector< T, N, Allocator >::~SmallVector ( )
inline

Definition at line 55 of file dfe_smallvector.hpp.

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

References dfe::SmallVector< T, N, Allocator >::clear().

+ Here is the call graph for this function:

Member Function Documentation

template<typename T , std::size_t N, typename Allocator >
SmallVector< T, N, Allocator >::AllocatedStorage dfe::SmallVector< T, N, Allocator >::allocate_storage ( size_type  capacity)
inlineprivate

Definition at line 107 of file dfe_smallvector.hpp.

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

References nanoflann::allocate(), dfe::SmallVector< T, N, Allocator >::capacity(), dfe::SmallVector< T, N, Allocator >::AllocatedStorage::capacity, dfe::SmallVector< T, N, Allocator >::AllocatedStorage::data, and Acts::UnitConstants::s.

Referenced by dfe::SmallVector< T, N, Allocator >::emplace().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T , std::size_t N, typename Allocator >
SmallVector< T, N, Allocator >::iterator dfe::SmallVector< T, N, Allocator >::begin ( )
inline

Definition at line 158 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 158 of file dfe_smallvector.hpp

References dfe::SmallVector< T, N, Allocator >::AllocatedStorage::data, dfe::SmallVector< T, N, Allocator >::m_size, charm_jet_strange_helicity::N, and T.

Referenced by dfe::SmallVector< T, N, Allocator >::emplace(), and dfe::SmallVector< T, N, Allocator >::end().

+ Here is the caller graph for this function:

template<typename T , std::size_t N, typename Allocator >
SmallVector< T, N, Allocator >::const_iterator dfe::SmallVector< T, N, Allocator >::begin ( ) const
inline
template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
size_type dfe::SmallVector< T, N, Allocator >::capacity ( ) const
inline

Return the number of elements that can be stored in the available memory.

Definition at line 70 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 70 of file dfe_smallvector.hpp

References dfe::SmallVector< T, N, Allocator >::AllocatedStorage::capacity, dfe::SmallVector< T, N, Allocator >::m_onheap, dfe::SmallVector< T, N, Allocator >::m_size, and charm_jet_strange_helicity::N.

Referenced by dfe::SmallVector< T, N, Allocator >::allocate_storage(), and dfe::SmallVector< T, N, Allocator >::emplace().

+ Here is the caller graph for this function:

template<typename T , std::size_t N, typename Allocator >
void dfe::SmallVector< T, N, Allocator >::clear ( )
inline

Remove all elements.

This will release allocated memory if the vector contains more elements than can be stored in-place.

Definition at line 170 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 170 of file dfe_smallvector.hpp

References dfe::SmallVector< T, N, Allocator >::destruct_deallocate_onheap(), dfe::SmallVector< T, N, Allocator >::destruct_inplace(), dfe::SmallVector< T, N, Allocator >::m_size, and charm_jet_strange_helicity::N.

Referenced by dfe::SmallVector< T, N, Allocator >::~SmallVector().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T , std::size_t N, typename Allocator >
void dfe::SmallVector< T, N, Allocator >::destruct_deallocate_onheap ( )
inlineprivate

Definition at line 127 of file dfe_smallvector.hpp.

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

References dfe::SmallVector< T, N, Allocator >::AllocatedStorage::capacity, dfe::SmallVector< T, N, Allocator >::AllocatedStorage::data, dfe::SmallVector< T, N, Allocator >::end(), dfe::SmallVector< T, N, Allocator >::m_alloc, dfe::SmallVector< T, N, Allocator >::m_size, and T.

Referenced by dfe::SmallVector< T, N, Allocator >::clear(), and dfe::SmallVector< T, N, Allocator >::emplace().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T , std::size_t N, typename Allocator >
void dfe::SmallVector< T, N, Allocator >::destruct_inplace ( )
inlineprivate

Definition at line 117 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 117 of file dfe_smallvector.hpp

References dfe::SmallVector< T, N, Allocator >::end(), dfe::SmallVector< T, N, Allocator >::m_size, and T.

Referenced by dfe::SmallVector< T, N, Allocator >::clear(), and dfe::SmallVector< T, N, Allocator >::emplace().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T , std::size_t N, typename Allocator >
template<typename... Args>
SmallVector< T, N, Allocator >::iterator dfe::SmallVector< T, N, Allocator >::emplace ( const_iterator  pos,
Args &&...  args 
)

Construct an element directly before the given position in the vector.

Definition at line 182 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 182 of file dfe_smallvector.hpp

References dfe::SmallVector< T, N, Allocator >::allocate_storage(), charm_jet_coverage::args, dfe::SmallVector< T, N, Allocator >::begin(), dfe::SmallVector< T, N, Allocator >::capacity(), dfe::SmallVector< T, N, Allocator >::destruct_deallocate_onheap(), dfe::SmallVector< T, N, Allocator >::destruct_inplace(), Acts::UnitConstants::e, dfe::SmallVector< T, N, Allocator >::end(), dfe::SmallVector< T, N, Allocator >::m_alloc, dfe::SmallVector< T, N, Allocator >::m_size, charm_jet_strange_helicity::N, pos(), dfe::SmallVector< T, N, Allocator >::size(), T, charm_jet_tagging_optimization_study::target, and nlohmann::detail::void().

Referenced by dfe::SmallVector< T, N, Allocator >::emplace_back().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T , std::size_t N, typename Allocator >
template<typename... Args>
SmallVector< T, N, Allocator >::value_type & dfe::SmallVector< T, N, Allocator >::emplace_back ( Args &&...  args)
inline

Construct an element at the back of the vector and return its reference.

Definition at line 239 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 239 of file dfe_smallvector.hpp

References charm_jet_coverage::args, dfe::SmallVector< T, N, Allocator >::emplace(), and dfe::SmallVector< T, N, Allocator >::end().

+ Here is the call graph for this function:

template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
bool dfe::SmallVector< T, N, Allocator >::empty ( ) const
inline

Return true if there are no elements in the vector.

Definition at line 66 of file dfe_smallvector.hpp.

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

References dfe::SmallVector< T, N, Allocator >::m_size.

template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
iterator dfe::SmallVector< T, N, Allocator >::end ( )
inline

Definition at line 61 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 61 of file dfe_smallvector.hpp

References dfe::SmallVector< T, N, Allocator >::begin(), and dfe::SmallVector< T, N, Allocator >::m_size.

Referenced by dfe::SmallVector< T, N, Allocator >::destruct_deallocate_onheap(), dfe::SmallVector< T, N, Allocator >::destruct_inplace(), dfe::SmallVector< T, N, Allocator >::emplace(), and dfe::SmallVector< T, N, Allocator >::emplace_back().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
const_iterator dfe::SmallVector< T, N, Allocator >::end ( ) const
inline

Definition at line 63 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 63 of file dfe_smallvector.hpp

References dfe::SmallVector< T, N, Allocator >::begin(), and dfe::SmallVector< T, N, Allocator >::m_size.

+ Here is the call graph for this function:

template<typename T , std::size_t N, typename Allocator >
T & dfe::SmallVector< T, N, Allocator >::operator[] ( size_type  idx)
inline
template<typename T , std::size_t N, typename Allocator >
const T & dfe::SmallVector< T, N, Allocator >::operator[] ( size_type  idx) const
inline
template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
size_type dfe::SmallVector< T, N, Allocator >::size ( ) const
inline

Return the number of elements in the vector.

Definition at line 68 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 68 of file dfe_smallvector.hpp

References dfe::SmallVector< T, N, Allocator >::m_size.

Referenced by dfe::SmallVector< T, N, Allocator >::emplace().

+ Here is the caller graph for this function:

Member Data Documentation

union { ... }
template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
Allocator dfe::SmallVector< T, N, Allocator >::m_alloc
private

Definition at line 100 of file dfe_smallvector.hpp.

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

Referenced by dfe::SmallVector< T, N, Allocator >::destruct_deallocate_onheap(), and dfe::SmallVector< T, N, Allocator >::emplace().

template<typename T, std::size_t N, typename Allocator = std::allocator<T>>
AllocatedStorage dfe::SmallVector< T, N, Allocator >::m_onheap

Definition at line 96 of file dfe_smallvector.hpp.

View newest version in sPHENIX GitHub at line 96 of file dfe_smallvector.hpp

Referenced by dfe::SmallVector< T, N, Allocator >::capacity().


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