CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes
edm::soahelper::SoATupleHelper< I, Args > Struct Template Reference

#include <SoATupleHelper.h>

Public Types

typedef AlignmentHelper< typename std::tuple_element< I - 1, std::tuple< Args... > >::typeAlignmentInfo
 
typedef SoATupleHelper< I - 1, Args... > NextHelper
 
typedef AlignmentInfo::Type Type
 

Public Member Functions

const SoATupleHelperoperator= (const SoATupleHelper &)=delete
 
 SoATupleHelper (const SoATupleHelper &)=delete
 

Static Public Member Functions

static size_t copyToNew (char *iNewMemory, size_t iSize, size_t iReserve, void *const *iFrom, void **oToSet)
 
static void destroy (void **iToSet, size_t iSize)
 
template<typename... FArgs>
static void emplace_back (void **iToSet, size_t iSize, FArgs... iValues)
 
static size_t moveToNew (char *iNewMemory, size_t iSize, size_t iReserve, void **oToSet)
 
static void push_back (void **iToSet, size_t iSize, std::tuple< Args... > const &iValues)
 
static size_t spaceNeededFor (unsigned int iNElements)
 

Static Public Attributes

static const std::size_t max_alignment
 

Detailed Description

template<unsigned int I, typename... Args>
struct edm::soahelper::SoATupleHelper< I, Args >

Implements most of the internal functions used by SoATuple. The argument I is used to recursively step through each arugment Args when doing the work. SoATupleHelper<I,Args> actually operates on the I-1 argument. There is a specialization of SoATulpeHelper with I=0 which is used to stop the template recursion.

Definition at line 91 of file SoATupleHelper.h.

Member Typedef Documentation

◆ AlignmentInfo

template<unsigned int I, typename... Args>
typedef AlignmentHelper<typename std::tuple_element<I - 1, std::tuple<Args...> >::type> edm::soahelper::SoATupleHelper< I, Args >::AlignmentInfo

Definition at line 92 of file SoATupleHelper.h.

◆ NextHelper

template<unsigned int I, typename... Args>
typedef SoATupleHelper<I - 1, Args...> edm::soahelper::SoATupleHelper< I, Args >::NextHelper

Definition at line 94 of file SoATupleHelper.h.

◆ Type

template<unsigned int I, typename... Args>
typedef AlignmentInfo::Type edm::soahelper::SoATupleHelper< I, Args >::Type

Definition at line 93 of file SoATupleHelper.h.

Constructor & Destructor Documentation

◆ SoATupleHelper()

template<unsigned int I, typename... Args>
edm::soahelper::SoATupleHelper< I, Args >::SoATupleHelper ( const SoATupleHelper< I, Args > &  )
delete

Member Function Documentation

◆ copyToNew()

template<unsigned int I, typename... Args>
size_t SoATupleHelper::copyToNew ( char *  iNewMemory,
size_t  iSize,
size_t  iReserve,
void *const *  iFrom,
void **  oToSet 
)
static

Definition at line 164 of file SoATupleHelper.h.

References Exhume::I, and edm::soahelper::padding_needed().

165  {
166  size_t usedSoFar = NextHelper::copyToNew(iNewMemory, iSize, iReserve, iFrom, oToSet);
167 
168  //find new start
169  const unsigned int boundary = AlignmentInfo::kAlignment;
170 
171  Type* newStart = reinterpret_cast<Type*>(iNewMemory + usedSoFar + padding_needed(usedSoFar, boundary));
172 
173  void* const* oldStart = iFrom + I - 1;
174 
175  Type* oldValues = static_cast<Type*>(*oldStart);
176  if (oldValues != nullptr) {
177  auto ptr = newStart;
178  for (auto it = oldValues; it != oldValues + iSize; ++it, ++ptr) {
179  new (ptr) Type(*it);
180  }
181  }
182  *(oToSet + I - 1) = newStart;
183  unsigned int additionalSize = padding_needed(usedSoFar, boundary) + iReserve * sizeof(Type);
184  return usedSoFar + additionalSize;
185  }
static size_t copyToNew(char *iNewMemory, size_t iSize, size_t iReserve, void *const *iFrom, void **oToSet)
const std::complex< double > I
Definition: I.h:8
constexpr unsigned int padding_needed(size_t iSizeSoFar, unsigned int iBoundary)
static const std::size_t kAlignment

◆ destroy()

template<unsigned int I, typename... Args>
void SoATupleHelper::destroy ( void **  iToSet,
size_t  iSize 
)
static

Definition at line 212 of file SoATupleHelper.h.

References Exhume::I, and contentValuesCheck::values.

212  {
213  void** start = iToSet + I - 1;
214  Type* values = static_cast<Type*>(*start);
215 
216  for (auto it = values; it != values + iSize; ++it) {
217  it->~Type();
218  }
219 
220  NextHelper::destroy(iToSet, iSize);
221  }
Definition: start.py:1
const std::complex< double > I
Definition: I.h:8
static void destroy(void **iToSet, size_t iSize)

◆ emplace_back()

template<unsigned int I, typename... Args>
template<typename... FArgs>
void SoATupleHelper::emplace_back ( void **  iToSet,
size_t  iSize,
FArgs...  iValues 
)
static

Definition at line 204 of file SoATupleHelper.h.

References Exhume::I.

204  {
205  new (static_cast<Type*>(*(iToSet + I - 1)) + iSize)
206  Type(arg_puller<0, I - 1, Type const&, FArgs...>::pull(std::forward<FArgs>(iValues)...));
207 
208  NextHelper::emplace_back(iToSet, iSize, std::forward<FArgs>(iValues)...);
209  }
const std::complex< double > I
Definition: I.h:8
static void emplace_back(void **iToSet, size_t iSize, FArgs... iValues)

◆ moveToNew()

template<unsigned int I, typename... Args>
size_t SoATupleHelper::moveToNew ( char *  iNewMemory,
size_t  iSize,
size_t  iReserve,
void **  oToSet 
)
static

Definition at line 138 of file SoATupleHelper.h.

References Exhume::I, eostools::move(), and edm::soahelper::padding_needed().

138  {
139  size_t usedSoFar = NextHelper::moveToNew(iNewMemory, iSize, iReserve, oToSet);
140 
141  //find new start
142  const unsigned int boundary = AlignmentInfo::kAlignment;
143 
144  Type* newStart = reinterpret_cast<Type*>(iNewMemory + usedSoFar + padding_needed(usedSoFar, boundary));
145 
146  void** oldStart = oToSet + I - 1;
147 
148  Type* oldValues = static_cast<Type*>(*oldStart);
149  if (oldValues != nullptr) {
150  auto ptr = newStart;
151  for (auto it = oldValues; it != oldValues + iSize; ++it, ++ptr) {
152  new (ptr) Type(std::move(*it));
153  }
154  for (auto it = oldValues; it != oldValues + iSize; ++it) {
155  it->~Type();
156  }
157  }
158  *oldStart = newStart;
159  unsigned int additionalSize = padding_needed(usedSoFar, boundary) + iReserve * sizeof(Type);
160  return usedSoFar + additionalSize;
161  }
static size_t moveToNew(char *iNewMemory, size_t iSize, size_t iReserve, void **oToSet)
const std::complex< double > I
Definition: I.h:8
def move(src, dest)
Definition: eostools.py:511
constexpr unsigned int padding_needed(size_t iSizeSoFar, unsigned int iBoundary)
static const std::size_t kAlignment

◆ operator=()

template<unsigned int I, typename... Args>
const SoATupleHelper& edm::soahelper::SoATupleHelper< I, Args >::operator= ( const SoATupleHelper< I, Args > &  )
delete

◆ push_back()

template<unsigned int I, typename... Args>
void SoATupleHelper::push_back ( void **  iToSet,
size_t  iSize,
std::tuple< Args... > const &  iValues 
)
static

Definition at line 196 of file SoATupleHelper.h.

References Exhume::I, and push_back().

196  {
197  new (static_cast<Type*>(*(iToSet + I - 1)) + iSize) Type(std::get<I - 1>(iValues));
198 
199  NextHelper::push_back(iToSet, iSize, iValues);
200  }
static void push_back(void **iToSet, size_t iSize, std::tuple< Args... > const &iValues)
const std::complex< double > I
Definition: I.h:8

◆ spaceNeededFor()

template<unsigned int I, typename... Args>
size_t SoATupleHelper::spaceNeededFor ( unsigned int  iNElements)
static

Definition at line 188 of file SoATupleHelper.h.

References edm::soahelper::padding_needed().

188  {
189  size_t usedSoFar = NextHelper::spaceNeededFor(iNElements);
190  const unsigned int boundary = AlignmentInfo::kAlignment;
191  unsigned int additionalSize = padding_needed(usedSoFar, boundary) + iNElements * sizeof(Type);
192  return usedSoFar + additionalSize;
193  }
static size_t spaceNeededFor(unsigned int iNElements)
constexpr unsigned int padding_needed(size_t iSizeSoFar, unsigned int iBoundary)
static const std::size_t kAlignment

Member Data Documentation

◆ max_alignment

template<unsigned int I, typename... Args>
const std::size_t edm::soahelper::SoATupleHelper< I, Args >::max_alignment
static