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 96 of file SoATupleHelper.h.

Member Typedef Documentation

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 98 of file SoATupleHelper.h.

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

Definition at line 100 of file SoATupleHelper.h.

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

Definition at line 99 of file SoATupleHelper.h.

Constructor & Destructor Documentation

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

Member Function Documentation

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 174 of file SoATupleHelper.h.

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

174  {
175  size_t usedSoFar = NextHelper::copyToNew(iNewMemory,iSize, iReserve, iFrom, oToSet);
176 
177  //find new start
178  const unsigned int boundary = AlignmentInfo::kAlignment;
179 
180  Type* newStart = reinterpret_cast<Type*>(iNewMemory+usedSoFar+padding_needed(usedSoFar,boundary));
181 
182  void* const* oldStart = iFrom+I-1;
183 
184  Type* oldValues = static_cast<Type*>(*oldStart);
185  if(oldValues != nullptr ) {
186  auto ptr = newStart;
187  for(auto it = oldValues; it != oldValues+iSize; ++it,++ptr) {
188  new (ptr) Type(*it);
189  }
190  }
191  *(oToSet+I-1) = newStart;
192  unsigned int additionalSize = padding_needed(usedSoFar,boundary) + iReserve*sizeof(Type);
193  return usedSoFar+additionalSize;
194  }
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
template<unsigned int I, typename... Args>
void SoATupleHelper::destroy ( void **  iToSet,
size_t  iSize 
)
static

Definition at line 221 of file SoATupleHelper.h.

References pyrootRender::destroy(), and MuonErrorMatrixValues_cff::values.

221  {
222  void** start = iToSet+I-1;
223  Type* values = static_cast<Type*>(*start);
224 
225  for(auto it = values; it != values+iSize; ++it) {
226  it->~Type();
227  }
228 
229  NextHelper::destroy(iToSet,iSize);
230  }
Definition: start.py:1
const std::complex< double > I
Definition: I.h:8
static void destroy(void **iToSet, size_t iSize)
template<unsigned int I, typename... Args>
template<typename... FArgs>
void SoATupleHelper::emplace_back ( void **  iToSet,
size_t  iSize,
FArgs...  iValues 
)
static

Definition at line 214 of file SoATupleHelper.h.

References Exhume::I.

214  {
215  new (static_cast<Type*>(*(iToSet+I-1))+iSize) Type(arg_puller<0,I-1,Type const&, FArgs...>::pull(std::forward<FArgs>(iValues)...));
216 
217  NextHelper::emplace_back(iToSet,iSize,std::forward<FArgs>(iValues)...);
218  }
static void emplace_back(void **iToSet, size_t iSize, FArgs...iValues)
const std::complex< double > I
Definition: I.h:8
template<unsigned int I, typename... Args>
size_t SoATupleHelper::moveToNew ( char *  iNewMemory,
size_t  iSize,
size_t  iReserve,
void **  oToSet 
)
static

Definition at line 148 of file SoATupleHelper.h.

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

148  {
149  size_t usedSoFar = NextHelper::moveToNew(iNewMemory,iSize, iReserve, oToSet);
150 
151  //find new start
152  const unsigned int boundary = AlignmentInfo::kAlignment;
153 
154  Type* newStart = reinterpret_cast<Type*>(iNewMemory+usedSoFar+padding_needed(usedSoFar,boundary));
155 
156  void** oldStart = oToSet+I-1;
157 
158  Type* oldValues = static_cast<Type*>(*oldStart);
159  if(oldValues != nullptr ) {
160  auto ptr = newStart;
161  for(auto it = oldValues; it != oldValues+iSize; ++it,++ptr) {
162  new (ptr) Type(std::move(*it));
163  }
164  for(auto it = oldValues; it != oldValues+iSize; ++it) {
165  it->~Type();
166  }
167  }
168  *oldStart = newStart;
169  unsigned int additionalSize = padding_needed(usedSoFar,boundary) + iReserve*sizeof(Type);
170  return usedSoFar+additionalSize;
171  }
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:510
constexpr unsigned int padding_needed(size_t iSizeSoFar, unsigned int iBoundary)
static const std::size_t kAlignment
template<unsigned int I, typename... Args>
const SoATupleHelper& edm::soahelper::SoATupleHelper< I, Args >::operator= ( const SoATupleHelper< I, Args > &  )
delete
template<unsigned int I, typename... Args>
void SoATupleHelper::push_back ( void **  iToSet,
size_t  iSize,
std::tuple< Args... > const &  iValues 
)
static

Definition at line 206 of file SoATupleHelper.h.

References Exhume::I.

206  {
207  new (static_cast<Type*>(*(iToSet+I-1))+iSize) Type(std::get<I-1>(iValues));
208 
209  NextHelper::push_back(iToSet,iSize,iValues);
210  }
static void push_back(void **iToSet, size_t iSize, std::tuple< Args... > const &iValues)
const std::complex< double > I
Definition: I.h:8
template<unsigned int I, typename... Args>
size_t SoATupleHelper::spaceNeededFor ( unsigned int  iNElements)
static

Definition at line 198 of file SoATupleHelper.h.

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

198  {
199  size_t usedSoFar = NextHelper::spaceNeededFor(iNElements);
200  const unsigned int boundary = AlignmentInfo::kAlignment;
201  unsigned int additionalSize = padding_needed(usedSoFar,boundary) + iNElements*sizeof(Type);
202  return usedSoFar+additionalSize;
203  }
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

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