CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes
edm::soa::Table< Args > Class Template Reference

#include <Table.h>

Classes

struct  CtrFillerFromAOS
 
struct  CtrFillerFromContainers
 

Public Types

using const_iterator = ConstTableItr< Args... >
 
using iterator = TableItr< Args... >
 
using Layout = std::tuple< Args... >
 

Public Member Functions

iterator begin ()
 
const_iterator begin () const
 
template<typename U >
MutableColumnValues< typename U::typecolumn ()
 
template<typename U >
ColumnValues< typename U::typecolumn () const
 
void const * columnAddressByIndex (unsigned int iIndex) const
 
template<typename U >
void const * columnAddressWorkaround (U const *) const
 
iterator end ()
 
const_iterator end () const
 
template<typename U >
U::typeget (size_t iRow)
 
template<typename U >
U::type const & get (size_t iRow) const
 
Table< Args... > & operator= (Table< Args... > &&iOther)
 
Table< Args... > & operator= (Table< Args... > const &iOther)
 
void resize (unsigned int iNewSize)
 
MutableRowView< Args... > row (size_t iRow)
 
RowView< Args... > row (size_t iRow) const
 
unsigned int size () const
 
 Table ()
 
template<typename T , typename... CArgs>
 Table (T const &iContainer, CArgs... iArgs)
 
template<typename T , typename... CArgs>
 Table (T const &iContainer, ColumnFillers< CArgs... > iFiller)
 
 Table (Table< Args... > &&iOther)
 
 Table (Table< Args... > const &iOther)
 
 ~Table ()
 

Static Public Attributes

static constexpr const unsigned int kNColumns = sizeof...(Args)
 

Private Member Functions

template<typename U >
void * columnAddress ()
 
template<typename U >
void const * columnAddress () const
 keep ROOT from trying to store this More...
 

Static Private Member Functions

template<int I>
static void copyFromToWithResize (size_t iNElements, std::array< void *, sizeof...(Args)> const &iFrom, std::array< void *, sizeof...(Args)> &oTo)
 
template<size_t... I>
static void copyFromToWithResizeAll (size_t iNElements, std::array< void *, sizeof...(Args)> const &iFrom, std::array< void *, sizeof...(Args)> &oTo, std::index_sequence< I... >)
 
template<int I>
static void dtr (std::array< void *, sizeof...(Args)> &iArray)
 
template<int I>
static void resetStartingAt (size_t iStartIndex, size_t iEndIndex, std::array< void *, sizeof...(Args)> &ioArray)
 
template<int I>
static void resizeFromTo (size_t iOldSize, size_t iNewSize, std::array< void *, sizeof...(Args)> &ioArray)
 

Private Attributes

unsigned int m_size = 0
 
std::array< void *, sizeof...(Args)> m_values = {{nullptr}}
 

Detailed Description

template<typename... Args>
class edm::soa::Table< Args >

Definition at line 137 of file Table.h.

Member Typedef Documentation

◆ const_iterator

template<typename... Args>
using edm::soa::Table< Args >::const_iterator = ConstTableItr<Args...>

Definition at line 141 of file Table.h.

◆ iterator

template<typename... Args>
using edm::soa::Table< Args >::iterator = TableItr<Args...>

Definition at line 142 of file Table.h.

◆ Layout

template<typename... Args>
using edm::soa::Table< Args >::Layout = std::tuple<Args...>

Definition at line 140 of file Table.h.

Constructor & Destructor Documentation

◆ Table() [1/5]

template<typename... Args>
template<typename T , typename... CArgs>
edm::soa::Table< Args >::Table ( T const &  iContainer,
CArgs...  iArgs 
)
inline

Definition at line 145 of file Table.h.

145  : m_size(iContainer.size()) {
146  if constexpr (sizeof...(CArgs) == 0) {
147  CtrFillerFromAOS::fill(m_values, iContainer);
148  } else {
149  CtrFillerFromContainers::fill(m_values, iContainer, std::forward<CArgs>(iArgs)...);
150  }
151  }

◆ Table() [2/5]

template<typename... Args>
template<typename T , typename... CArgs>
edm::soa::Table< Args >::Table ( T const &  iContainer,
ColumnFillers< CArgs... >  iFiller 
)
inline

Definition at line 154 of file Table.h.

154  {
155  m_size = iContainer.size();
156  CtrFillerFromAOS::fillUsingFiller(iFiller, m_values, iContainer);
157  }

◆ Table() [3/5]

template<typename... Args>
edm::soa::Table< Args >::Table ( Table< Args... > const &  iOther)
inline

Definition at line 159 of file Table.h.

159  : m_size(iOther.m_size), m_values{{nullptr}} {
160  copyFromToWithResizeAll(m_size, iOther.m_values, m_values, std::make_index_sequence<sizeof...(Args)>{});
161  }

◆ Table() [4/5]

template<typename... Args>
edm::soa::Table< Args >::Table ( Table< Args... > &&  iOther)
inline

Definition at line 163 of file Table.h.

163  : m_size(0), m_values{{nullptr}} {
164  std::swap(m_size, iOther.m_size);
165  std::swap(m_values, iOther.m_values);
166  }

◆ Table() [5/5]

template<typename... Args>
edm::soa::Table< Args >::Table ( )
inline

Definition at line 168 of file Table.h.

168 : m_size(0) {}

◆ ~Table()

template<typename... Args>
edm::soa::Table< Args >::~Table ( )
inline

Definition at line 170 of file Table.h.

170 { dtr<0>(m_values); }

Member Function Documentation

◆ begin() [1/2]

template<typename... Args>
iterator edm::soa::Table< Args >::begin ( void  )
inline

Definition at line 230 of file Table.h.

230 { return iterator{m_values}; }

◆ begin() [2/2]

template<typename... Args>
const_iterator edm::soa::Table< Args >::begin ( void  ) const
inline

Definition at line 215 of file Table.h.

215  {
216  std::array<void const*, sizeof...(Args)> t;
217  for (size_t i = 0; i < t.size(); ++i) {
218  t[i] = m_values[i];
219  }
220  return const_iterator{t};
221  }

Referenced by edm::soa::Table< edm::soa::col::Pt, edm::soa::col::Eta, edm::soa::col::Phi, edm::soa::col::Vz >::row().

◆ column() [1/2]

template<typename... Args>
template<typename U >
MutableColumnValues<typename U::type> edm::soa::Table< Args >::column ( )
inline

Definition at line 208 of file Table.h.

208  {
209  return MutableColumnValues<typename U::type>{static_cast<typename U::type*>(columnAddress<U>()), m_size};
210  }

◆ column() [2/2]

template<typename... Args>
template<typename U >
ColumnValues<typename U::type> edm::soa::Table< Args >::column ( ) const
inline

Definition at line 204 of file Table.h.

204  {
205  return ColumnValues<typename U::type>{static_cast<typename U::type*>(columnAddress<U>()), m_size};
206  }

◆ columnAddress() [1/2]

template<typename... Args>
template<typename U >
void* edm::soa::Table< Args >::columnAddress ( )
inlineprivate

Definition at line 251 of file Table.h.

251  {
253  }

◆ columnAddress() [2/2]

template<typename... Args>
template<typename U >
void const* edm::soa::Table< Args >::columnAddress ( ) const
inlineprivate

keep ROOT from trying to store this

Definition at line 246 of file Table.h.

246  {
248  }

◆ columnAddressByIndex()

template<typename... Args>
void const* edm::soa::Table< Args >::columnAddressByIndex ( unsigned int  iIndex) const
inline

Definition at line 238 of file Table.h.

238 { return m_values[iIndex]; }

◆ columnAddressWorkaround()

template<typename... Args>
template<typename U >
void const* edm::soa::Table< Args >::columnAddressWorkaround ( U const *  ) const
inline

Definition at line 234 of file Table.h.

234  {
235  return columnAddress<U>();
236  }

◆ copyFromToWithResize()

template<typename... Args>
template<int I>
static void edm::soa::Table< Args >::copyFromToWithResize ( size_t  iNElements,
std::array< void *, sizeof...(Args)> const &  iFrom,
std::array< void *, sizeof...(Args)> &  oTo 
)
inlinestaticprivate

Definition at line 366 of file Table.h.

368  {
369  using Layout = std::tuple<Args...>;
371  Type* oldPtr = static_cast<Type*>(oTo[I]);
372  Type* ptr = new Type[iNElements];
373  oTo[I] = ptr;
374  std::copy(static_cast<Type const*>(iFrom[I]), static_cast<Type const*>(iFrom[I]) + iNElements, ptr);
375  delete[] oldPtr;
376  }

◆ copyFromToWithResizeAll()

template<typename... Args>
template<size_t... I>
static void edm::soa::Table< Args >::copyFromToWithResizeAll ( size_t  iNElements,
std::array< void *, sizeof...(Args)> const &  iFrom,
std::array< void *, sizeof...(Args)> &  oTo,
std::index_sequence< I... >   
)
inlinestaticprivate

Definition at line 358 of file Table.h.

361  {
362  (copyFromToWithResize<I>(iNElements, iFrom, oTo), ...);
363  }

◆ dtr()

template<typename... Args>
template<int I>
static void edm::soa::Table< Args >::dtr ( std::array< void *, sizeof...(Args)> &  iArray)
inlinestaticprivate

Definition at line 257 of file Table.h.

257  {
258  if constexpr (I < sizeof...(Args)) {
260  delete[] static_cast<Type*>(iArray[I]);
261  dtr<I + 1>(iArray);
262  }
263  }

◆ end() [1/2]

template<typename... Args>
iterator edm::soa::Table< Args >::end ( void  )
inline

Definition at line 231 of file Table.h.

231 { return iterator{m_values, size()}; }

◆ end() [2/2]

template<typename... Args>
const_iterator edm::soa::Table< Args >::end ( void  ) const
inline

Definition at line 222 of file Table.h.

222  {
223  std::array<void const*, sizeof...(Args)> t;
224  for (size_t i = 0; i < t.size(); ++i) {
225  t[i] = m_values[i];
226  }
227  return const_iterator{t, size()};
228  }

◆ get() [1/2]

template<typename... Args>
template<typename U >
U::type& edm::soa::Table< Args >::get ( size_t  iRow)
inline

◆ get() [2/2]

template<typename... Args>
template<typename U >
U::type const& edm::soa::Table< Args >::get ( size_t  iRow) const
inline

◆ operator=() [1/2]

template<typename... Args>
Table<Args...>& edm::soa::Table< Args >::operator= ( Table< Args... > &&  iOther)
inline

Definition at line 172 of file Table.h.

172  {
173  Table<Args...> cp(std::move(iOther));
174  std::swap(m_size, cp.m_size);
175  std::swap(m_values, cp.m_values);
176  return *this;
177  }

◆ operator=() [2/2]

template<typename... Args>
Table<Args...>& edm::soa::Table< Args >::operator= ( Table< Args... > const &  iOther)
inline

◆ resetStartingAt()

template<typename... Args>
template<int I>
static void edm::soa::Table< Args >::resetStartingAt ( size_t  iStartIndex,
size_t  iEndIndex,
std::array< void *, sizeof...(Args)> &  ioArray 
)
inlinestaticprivate

Definition at line 395 of file Table.h.

395  {
396  if constexpr (I < sizeof...(Args)) {
397  using Layout = std::tuple<Args...>;
399  auto ptr = static_cast<Type*>(ioArray[I]);
400  auto temp = Type{};
401  std::fill(ptr + iStartIndex, ptr + iEndIndex, temp);
402  resetStartingAt<I + 1>(iStartIndex, iEndIndex, ioArray);
403  }
404  }

◆ resize()

template<typename... Args>
void edm::soa::Table< Args >::resize ( unsigned int  iNewSize)
inline

Definition at line 182 of file Table.h.

182  {
183  if (m_size == iNewSize) {
184  return;
185  }
186  resizeFromTo<0>(m_size, iNewSize, m_values);
187  if (m_size < iNewSize) {
188  //initialize the extra values
189  resetStartingAt<0>(m_size, iNewSize, m_values);
190  }
191  m_size = iNewSize;
192  }

◆ resizeFromTo()

template<typename... Args>
template<int I>
static void edm::soa::Table< Args >::resizeFromTo ( size_t  iOldSize,
size_t  iNewSize,
std::array< void *, sizeof...(Args)> &  ioArray 
)
inlinestaticprivate

Definition at line 379 of file Table.h.

379  {
380  if constexpr (I < sizeof...(Args)) {
381  using Layout = std::tuple<Args...>;
383  Type* oldPtr = static_cast<Type*>(ioArray[I]);
384  auto ptr = new Type[iNewSize];
385  auto nToCopy = std::min(iOldSize, iNewSize);
386  std::copy(static_cast<Type const*>(ioArray[I]), static_cast<Type const*>(ioArray[I]) + nToCopy, ptr);
387  resizeFromTo<I + 1>(iOldSize, iNewSize, ioArray);
388 
389  delete[] oldPtr;
390  ioArray[I] = ptr;
391  }
392  }

◆ row() [1/2]

template<typename... Args>
MutableRowView<Args...> edm::soa::Table< Args >::row ( size_t  iRow)
inline

Definition at line 213 of file Table.h.

213 { return *(begin() + iRow); }

◆ row() [2/2]

template<typename... Args>
RowView<Args...> edm::soa::Table< Args >::row ( size_t  iRow) const
inline

Definition at line 212 of file Table.h.

212 { return *(begin() + iRow); }

◆ size()

template<typename... Args>
unsigned int edm::soa::Table< Args >::size ( void  ) const
inline

Member Data Documentation

◆ kNColumns

template<typename... Args>
constexpr const unsigned int edm::soa::Table< Args >::kNColumns = sizeof...(Args)
staticconstexpr

Definition at line 139 of file Table.h.

◆ m_size

template<typename... Args>
unsigned int edm::soa::Table< Args >::m_size = 0
private

◆ m_values

template<typename... Args>
std::array<void*, sizeof...(Args)> edm::soa::Table< Args >::m_values = {{nullptr}}
private
mps_fire.i
i
Definition: mps_fire.py:428
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
min
T min(T a, T b)
Definition: MathUtil.h:58
ColumnValues
mps_check.array
array
Definition: mps_check.py:216
hgcal_conditions::parameters
Definition: HGCConditions.h:86
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
Table
Exhume::I
const std::complex< double > I
Definition: I.h:8
susybsm::HSCParticleType::Type
Type
Definition: HSCParticle.h:20
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
edm::soa::Table::size
unsigned int size() const
Definition: Table.h:180
edm::soa::Table::operator=
Table< Args... > & operator=(Table< Args... > &&iOther)
Definition: Table.h:172
ntuplemaker.fill
fill
Definition: ntuplemaker.py:304
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
edm::soa::Table::CtrFillerFromAOS::fillUsingFiller
static size_t fillUsingFiller(F &iFiller, std::array< void *, sizeof...(Args)> &oValues, T const &iContainer)
Definition: Table.h:308
edm::soa::Table::m_values
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
edm::soa::Table::copyFromToWithResizeAll
static void copyFromToWithResizeAll(size_t iNElements, std::array< void *, sizeof...(Args)> const &iFrom, std::array< void *, sizeof...(Args)> &oTo, std::index_sequence< I... >)
Definition: Table.h:358
edm::soa::Table::const_iterator
ConstTableItr< Args... > const_iterator
Definition: Table.h:141
edm::soa::Table::CtrFillerFromAOS::fill
static size_t fill(std::array< void *, sizeof...(Args)> &oValues, T const &iContainer)
Definition: Table.h:297
edm::soa::Table::iterator
TableItr< Args... > iterator
Definition: Table.h:142
edm::soa::Table::m_size
unsigned int m_size
Definition: Table.h:242
edm::soa::impl::GetIndex::index
static constexpr int index
Definition: tablehelpers.h:39
edm::soa::Table::Layout
std::tuple< Args... > Layout
Definition: Table.h:140
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::soa::Table::CtrFillerFromContainers::fill
static size_t fill(std::array< void *, sizeof...(Args)> &oValues, T const &iContainer, U... iArgs)
Definition: Table.h:268
CommonMethods.cp
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
Definition: CommonMethods.py:191
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
edm::soa::Table::begin
const_iterator begin() const
Definition: Table.h:215