#include <SoATuple.h>
Public Types | |
typedef std::tuple< Args...> | element |
Public Member Functions | |
template<unsigned int I> | |
soahelper::AlignmentHelper < typename std::tuple_element < I, std::tuple< Args...> >::type >::Type const * | begin () const |
template<unsigned int I> | |
soahelper::AlignmentHelper < typename std::tuple_element < I, std::tuple< Args...> >::type >::Type * | begin () |
size_t | capacity () const |
template<typename... FArgs> | |
void | emplace_back (FArgs &&...values) |
template<unsigned int I> | |
soahelper::AlignmentHelper < typename std::tuple_element < I, std::tuple< Args...> >::type >::Type * | end () |
template<unsigned int I> | |
soahelper::AlignmentHelper < typename std::tuple_element < I, std::tuple< Args...> >::type >::Type const * | end () const |
template<unsigned int I> | |
soahelper::AlignmentHelper < typename std::tuple_element < I, std::tuple< Args...> >::type >::Type const & | get (unsigned int iIndex) const |
template<unsigned int I> | |
soahelper::AlignmentHelper < typename std::tuple_element < I, std::tuple< Args...> >::type >::Type & | get (unsigned int iIndex) |
const SoATuple< Args...> & | operator= (const SoATuple< Args...> &iRHS) |
void | push_back (element const &values) |
void | reserve (unsigned int iToSize) |
void | shrink_to_fit () |
size_t | size () const |
SoATuple (const SoATuple< Args...> &iOther) | |
SoATuple () | |
SoATuple (SoATuple< Args...> &&iOther) | |
void | swap (SoATuple< Args...> &iOther) |
~SoATuple () | |
Private Member Functions | |
void | changeSize (unsigned int iToSize) |
Private Attributes | |
size_t | m_reserved |
size_t | m_size |
void * | m_values [sizeof...(Args)] |
Definition at line 108 of file SoATuple.h.
typedef std::tuple<Args...> edm::SoATuple< Args >::element |
Definition at line 112 of file SoATuple.h.
edm::SoATuple< Args >::SoATuple | ( | ) | [inline] |
Definition at line 114 of file SoATuple.h.
: m_size(0),m_reserved(0){ for(auto& v : m_values) { v = nullptr; } }
edm::SoATuple< Args >::SoATuple | ( | const SoATuple< Args...> & | iOther | ) | [inline] |
Definition at line 119 of file SoATuple.h.
:m_size(0),m_reserved(0) { for(auto& v : m_values) { v = nullptr; } reserve(iOther.m_size); soahelper::SoATupleHelper<sizeof...(Args),Args...>::copyToNew(static_cast<char*>(m_values[0]),iOther.m_size,m_reserved,iOther.m_values,m_values); m_size = iOther.m_size; }
edm::SoATuple< Args >::SoATuple | ( | SoATuple< Args...> && | iOther | ) | [inline] |
Definition at line 128 of file SoATuple.h.
edm::SoATuple< Args >::~SoATuple | ( | ) | [inline] |
Definition at line 141 of file SoATuple.h.
{ soahelper::SoATupleHelper<sizeof...(Args),Args...>::destroy(m_values,m_size); typedef std::aligned_storage<soahelper::SoATupleHelper<sizeof...(Args),Args...>::max_alignment, soahelper::SoATupleHelper<sizeof...(Args),Args...>::max_alignment> AlignedType; delete [] static_cast<AlignedType*>(m_values[0]); }
soahelper::AlignmentHelper<typename std::tuple_element<I, std::tuple<Args...> >::type>::Type const* edm::SoATuple< Args >::begin | ( | void | ) | const [inline] |
Returns the beginning of the container holding all Ith data elements
Definition at line 162 of file SoATuple.h.
Referenced by edm::EDConsumerBase::itemsMayGet(), edm::EDConsumerBase::itemsToGet(), and edm::EDConsumerBase::updateLookup().
{ typedef soahelper::AlignmentHelper<typename std::tuple_element<I, std::tuple<Args...>>::type> Helper; typedef typename Helper::Type ReturnType; #if GCC_PREREQUISITE(4,7,0) return static_cast<ReturnType const*>(__builtin_assume_aligned(m_values[I],Helper::kAlignment)); #else return static_cast<ReturnType const*>(m_values[I]); #endif }
soahelper::AlignmentHelper<typename std::tuple_element<I, std::tuple<Args...> >::type>::Type* edm::SoATuple< Args >::begin | ( | void | ) | [inline] |
Returns the beginning of the container holding all Ith data elements
Definition at line 221 of file SoATuple.h.
{ typedef soahelper::AlignmentHelper<typename std::tuple_element<I, std::tuple<Args...>>::type> Helper; typedef typename Helper::Type ReturnType; #if GCC_PREREQUISITE(4,7,0) return static_cast<ReturnType*>(__builtin_assume_aligned(m_values[I],Helper::kAlignment)); #else return static_cast<ReturnType*>(m_values[I]); #endif }
size_t edm::SoATuple< Args >::capacity | ( | ) | const [inline] |
Definition at line 151 of file SoATuple.h.
Referenced by edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::emplace_back(), and edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::push_back().
{return m_reserved;}
void edm::SoATuple< Args >::changeSize | ( | unsigned int | iToSize | ) | [inline, private] |
Definition at line 246 of file SoATuple.h.
Referenced by edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::reserve(), and edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::shrink_to_fit().
{ assert(m_size<=iToSize); const size_t memoryNeededInBytes = soahelper::SoATupleHelper<sizeof...(Args),Args...>::spaceNeededFor(iToSize); //align memory of the array to be on the strictest alignment boundary for any type in the Tuple // This is done by creating an array of a type that has that same alignment restriction and minimum size. // This has the draw back of possibly padding the array by one extra element if the memoryNeededInBytes is not // a strict multiple of max_alignment. // NOTE: using new char[...] would likely cause more padding based on C++11 5.3.4 paragraph 10 where it // says the alignment will be for the strictest requirement for an object whose size < size of array. So // if the array were for 64 bytes and the strictest requirement of any object was 8 bytes then the entire // char array would be aligned on an 8 byte boundary. However, if the SoATuple<char,char> only 1 byte alignment // is needed. The following algorithm would require only 1 byte alignment const std::size_t max_alignment = soahelper::SoATupleHelper<sizeof...(Args),Args...>::max_alignment; typedef std::aligned_storage<soahelper::SoATupleHelper<sizeof...(Args),Args...>::max_alignment, soahelper::SoATupleHelper<sizeof...(Args),Args...>::max_alignment> AlignedType; //If needed, pad the number of items by 1 const size_t itemsNeeded = (memoryNeededInBytes+max_alignment-1)/sizeof(AlignedType); char * newMemory = static_cast<char*>(static_cast<void*>(new AlignedType[itemsNeeded])); void * oldMemory =m_values[0]; soahelper::SoATupleHelper<sizeof...(Args),Args...>::moveToNew(newMemory,m_size, iToSize, m_values); m_reserved = iToSize; delete [] static_cast<AlignedType*>(oldMemory); }
void edm::SoATuple< Args >::emplace_back | ( | FArgs &&... | values | ) | [inline] |
Adds one entry to the end of the list. The arguments are used to instantiate each data element in the order defined in the template arguments.
Definition at line 204 of file SoATuple.h.
Referenced by edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::emplace_back(), edm::EDConsumerBase::recordConsumes(), and edm::EDConsumerBase::updateLookup().
soahelper::AlignmentHelper<typename std::tuple_element<I, std::tuple<Args...> >::type>::Type* edm::SoATuple< Args >::end | ( | void | ) | [inline] |
soahelper::AlignmentHelper<typename std::tuple_element<I, std::tuple<Args...> >::type>::Type const* edm::SoATuple< Args >::end | ( | void | ) | const [inline] |
Returns the end of the container holding all Ith data elements
Definition at line 173 of file SoATuple.h.
Referenced by edm::EDConsumerBase::itemsMayGet(), edm::EDConsumerBase::itemsToGet(), and edm::EDConsumerBase::updateLookup().
soahelper::AlignmentHelper<typename std::tuple_element<I, std::tuple<Args...> >::type>::Type const& edm::SoATuple< Args >::get | ( | unsigned int | iIndex | ) | const [inline] |
Returns const access to data element I of item iIndex
Definition at line 155 of file SoATuple.h.
Referenced by edm::EDConsumerBase::indexFrom(), edm::EDConsumerBase::labelsForToken(), edm::EDConsumerBase::throwBranchMismatch(), edm::EDConsumerBase::throwTypeMismatch(), and edm::EDConsumerBase::updateLookup().
soahelper::AlignmentHelper<typename std::tuple_element<I, std::tuple<Args...> >::type>::Type& edm::SoATuple< Args >::get | ( | unsigned int | iIndex | ) | [inline] |
const SoATuple<Args...>& edm::SoATuple< Args >::operator= | ( | const SoATuple< Args...> & | iRHS | ) | [inline] |
void edm::SoATuple< Args >::push_back | ( | element const & | values | ) | [inline] |
Adds one entry to the end of the list. Memory grows as needed.
Definition at line 194 of file SoATuple.h.
Referenced by edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::push_back().
void edm::SoATuple< Args >::reserve | ( | unsigned int | iToSize | ) | [inline] |
Makes sure to hold enough memory to contain at least iToSize entries.
Definition at line 180 of file SoATuple.h.
Referenced by edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::emplace_back(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::push_back(), and edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::SoATuple().
{ if(iToSize > m_reserved) { changeSize(iToSize); } }
void edm::SoATuple< Args >::shrink_to_fit | ( | ) | [inline] |
Shrinks the amount of memory used so as to only have just enough to hold all entries.
Definition at line 187 of file SoATuple.h.
Referenced by edm::EDConsumerBase::updateLookup().
{ if(m_reserved > m_size) { changeSize(m_size); } }
size_t edm::SoATuple< Args >::size | ( | void | ) | const [inline] |
Definition at line 150 of file SoATuple.h.
Referenced by edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::emplace_back(), edm::EDConsumerBase::indexFrom(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::push_back(), edm::EDConsumerBase::recordConsumes(), and edm::EDConsumerBase::updateLookup().
{ return m_size;}
void edm::SoATuple< Args >::swap | ( | SoATuple< Args...> & | iOther | ) | [inline] |
Definition at line 237 of file SoATuple.h.
Referenced by edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::operator=(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::SoATuple(), and edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::swap().
size_t edm::SoATuple< Args >::m_reserved [private] |
Definition at line 274 of file SoATuple.h.
Referenced by edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::capacity(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::changeSize(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::reserve(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::shrink_to_fit(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::SoATuple(), and edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::swap().
size_t edm::SoATuple< Args >::m_size [private] |
Definition at line 273 of file SoATuple.h.
Referenced by edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::changeSize(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::emplace_back(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::end(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::push_back(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::shrink_to_fit(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::size(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::SoATuple(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::swap(), and edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::~SoATuple().
void* edm::SoATuple< Args >::m_values[sizeof...(Args)] [private] |
Definition at line 272 of file SoATuple.h.
Referenced by edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::begin(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::changeSize(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::emplace_back(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::end(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::get(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::push_back(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::SoATuple(), edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::swap(), and edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType >::~SoATuple().