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

const_iterator begin () const
 
iterator begin ()
 
template<typename U >
ColumnValues< typename U::typecolumn () const
 
template<typename U >
MutableColumnValues< typename U::typecolumn ()
 
void const * columnAddressByIndex (unsigned int iIndex) const
 
template<typename U >
void const * columnAddressWorkaround (U const *) const
 
const_iterator end () const
 
iterator end ()
 
template<typename U >
U::type const & get (size_t iRow) const
 
template<typename U >
U::typeget (size_t iRow)
 
Table< Args... > & operator= (Table< Args... > &&iOther)
 
Table< Args... > & operator= (Table< Args... > const &iOther)
 
void resize (unsigned int iNewSize)
 
RowView< Args... > row (size_t iRow) const
 
MutableRowView< Args... > row (size_t iRow)
 
unsigned int size () const
 
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... > const &iOther)
 
 Table (Table< Args... > &&iOther)
 
 Table ()
 
 ~Table ()
 

Static Public Attributes

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

Private Member Functions

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

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

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

Definition at line 141 of file Table.h.

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

Definition at line 142 of file Table.h.

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

Definition at line 140 of file Table.h.

Constructor & Destructor Documentation

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.

References constexpr, edm::soa::Table< Args >::CtrFillerFromContainers::fill(), edm::soa::Table< Args >::CtrFillerFromAOS::fill(), and edm::soa::Table< Args >::m_values.

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  }
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
static size_t fill(std::array< void *, sizeof...(Args)> &oValues, T const &iContainer, U...iArgs)
Definition: Table.h:268
static size_t fill(std::array< void *, sizeof...(Args)> &oValues, T const &iContainer)
Definition: Table.h:297
unsigned int m_size
Definition: Table.h:242
#define constexpr
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.

References edm::soa::Table< Args >::CtrFillerFromAOS::fillUsingFiller(), edm::soa::Table< Args >::m_size, and edm::soa::Table< Args >::m_values.

154  {
155  m_size = iContainer.size();
156  CtrFillerFromAOS::fillUsingFiller(iFiller, m_values, iContainer);
157  }
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
unsigned int m_size
Definition: Table.h:242
static size_t fillUsingFiller(F &iFiller, std::array< void *, sizeof...(Args)> &oValues, T const &iContainer)
Definition: Table.h:308
template<typename... Args>
edm::soa::Table< Args >::Table ( Table< Args... > const &  iOther)
inline

Definition at line 159 of file Table.h.

References edm::soa::Table< Args >::copyFromToWithResizeAll(), edm::soa::Table< Args >::m_size, and edm::soa::Table< Args >::m_values.

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  }
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
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
unsigned int m_size
Definition: Table.h:242
template<typename... Args>
edm::soa::Table< Args >::Table ( Table< Args... > &&  iOther)
inline

Definition at line 163 of file Table.h.

References edm::soa::Table< Args >::m_size, edm::soa::Table< Args >::m_values, and std::swap().

163  : m_size(0), m_values{{nullptr}} {
164  std::swap(m_size, iOther.m_size);
165  std::swap(m_values, iOther.m_values);
166  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
unsigned int m_size
Definition: Table.h:242
template<typename... Args>
edm::soa::Table< Args >::Table ( )
inline

Definition at line 168 of file Table.h.

168 : m_size(0) {}
unsigned int m_size
Definition: Table.h:242
template<typename... Args>
edm::soa::Table< Args >::~Table ( )
inline

Definition at line 170 of file Table.h.

References edm::soa::Table< Args >::m_values.

170 { dtr<0>(m_values); }
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243

Member Function Documentation

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

Definition at line 215 of file Table.h.

References mps_check::array, mps_fire::i, edm::soa::Table< Args >::m_values, and protons_cff::t.

Referenced by edm::soa::Table< Args >::row().

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  }
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
ConstTableItr< Args... > const_iterator
Definition: Table.h:141
template<typename... Args>
iterator edm::soa::Table< Args >::begin ( void  )
inline

Definition at line 230 of file Table.h.

References edm::soa::Table< Args >::m_values.

230 { return iterator{m_values}; }
TableItr< Args... > iterator
Definition: Table.h:142
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
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.

References edm::soa::Table< Args >::m_size.

204  {
205  return ColumnValues<typename U::type>{static_cast<typename U::type*>(columnAddress<U>()), m_size};
206  }
type
Definition: HCALResponse.h:21
unsigned int m_size
Definition: Table.h:242
template<typename... Args>
template<typename U >
MutableColumnValues<typename U::type> edm::soa::Table< Args >::column ( )
inline

Definition at line 208 of file Table.h.

References edm::soa::Table< Args >::m_size.

208  {
209  return MutableColumnValues<typename U::type>{static_cast<typename U::type*>(columnAddress<U>()), m_size};
210  }
type
Definition: HCALResponse.h:21
unsigned int m_size
Definition: Table.h:242
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.

References edm::soa::Table< Args >::m_values.

246  {
248  }
static constexpr int index
Definition: tablehelpers.h:39
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
template<typename... Args>
template<typename U >
void* edm::soa::Table< Args >::columnAddress ( )
inlineprivate

Definition at line 251 of file Table.h.

References edm::soa::Table< Args >::m_values.

251  {
253  }
static constexpr int index
Definition: tablehelpers.h:39
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
template<typename... Args>
void const* edm::soa::Table< Args >::columnAddressByIndex ( unsigned int  iIndex) const
inline

Definition at line 238 of file Table.h.

References edm::soa::Table< Args >::m_values.

238 { return m_values[iIndex]; }
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
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  }
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.

References popcon2dropbox::copy(), and Exhume::I.

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  }
type
Definition: HCALResponse.h:21
def copy(args, dbName)
std::tuple< Args... > Layout
Definition: Table.h:140
const std::complex< double > I
Definition: I.h:8
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.

Referenced by edm::soa::Table< Args >::Table().

361  {
362  (copyFromToWithResize<I>(iNElements, iFrom, oTo), ...);
363  }
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.

References constexpr, and Exhume::I.

257  {
258  if constexpr (I < sizeof...(Args)) {
260  delete[] static_cast<Type*>(iArray[I]);
261  dtr<I + 1>(iArray);
262  }
263  }
type
Definition: HCALResponse.h:21
const std::complex< double > I
Definition: I.h:8
#define constexpr
template<typename... Args>
const_iterator edm::soa::Table< Args >::end ( void  ) const
inline

Definition at line 222 of file Table.h.

References mps_check::array, mps_fire::i, edm::soa::Table< Args >::m_values, edm::soa::Table< Args >::size(), and protons_cff::t.

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  }
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
ConstTableItr< Args... > const_iterator
Definition: Table.h:141
unsigned int size() const
Definition: Table.h:180
template<typename... Args>
iterator edm::soa::Table< Args >::end ( void  )
inline

Definition at line 231 of file Table.h.

References edm::soa::Table< Args >::m_values, and edm::soa::Table< Args >::size().

231 { return iterator{m_values, size()}; }
TableItr< Args... > iterator
Definition: Table.h:142
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
unsigned int size() const
Definition: Table.h:180
template<typename... Args>
template<typename U >
U::type const& edm::soa::Table< Args >::get ( size_t  iRow) const
inline
template<typename... Args>
template<typename U >
U::type& edm::soa::Table< Args >::get ( size_t  iRow)
inline
template<typename... Args>
Table<Args...>& edm::soa::Table< Args >::operator= ( Table< Args... > &&  iOther)
inline

Definition at line 172 of file Table.h.

References SimDataFormats::CaloAnalysis::cp, edm::soa::Table< Args >::m_size, edm::soa::Table< Args >::m_values, eostools::move(), and std::swap().

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  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
unsigned int m_size
Definition: Table.h:242
def move(src, dest)
Definition: eostools.py:511
template<typename... Args>
Table<Args...>& edm::soa::Table< Args >::operator= ( Table< Args... > const &  iOther)
inline

Definition at line 178 of file Table.h.

References edm::soa::Table< Args >::operator=().

Referenced by edm::soa::Table< Args >::operator=().

178 { return operator=(Table<Args...>(iOther)); }
Table< Args... > & operator=(Table< Args... > &&iOther)
Definition: Table.h:172
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.

References constexpr, lumiContext::fill, Exhume::I, and groupFilesInBlocks::temp.

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  }
type
Definition: HCALResponse.h:21
std::tuple< Args... > Layout
Definition: Table.h:140
const std::complex< double > I
Definition: I.h:8
#define constexpr
template<typename... Args>
void edm::soa::Table< Args >::resize ( unsigned int  iNewSize)
inline

Definition at line 182 of file Table.h.

References edm::soa::Table< Args >::m_size, and edm::soa::Table< Args >::m_values.

Referenced by Vispa.Gui.TextDialog.TextDialog::__init__(), Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog::__init__(), Vispa.Main.MainWindow.MainWindow::_loadIni(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

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  }
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:243
unsigned int m_size
Definition: Table.h:242
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.

References constexpr, popcon2dropbox::copy(), Exhume::I, and min().

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  }
type
Definition: HCALResponse.h:21
def copy(args, dbName)
std::tuple< Args... > Layout
Definition: Table.h:140
const std::complex< double > I
Definition: I.h:8
T min(T a, T b)
Definition: MathUtil.h:58
#define constexpr
template<typename... Args>
RowView<Args...> edm::soa::Table< Args >::row ( size_t  iRow) const
inline

Definition at line 212 of file Table.h.

References edm::soa::Table< Args >::begin().

212 { return *(begin() + iRow); }
const_iterator begin() const
Definition: Table.h:215
template<typename... Args>
MutableRowView<Args...> edm::soa::Table< Args >::row ( size_t  iRow)
inline

Definition at line 213 of file Table.h.

References edm::soa::Table< Args >::begin().

213 { return *(begin() + iRow); }
const_iterator begin() const
Definition: Table.h:215
template<typename... Args>
unsigned int edm::soa::Table< Args >::size ( void  ) const
inline

Member Data Documentation

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

Definition at line 139 of file Table.h.

template<typename... Args>
unsigned int edm::soa::Table< Args >::m_size = 0
private
template<typename... Args>
std::array<void*, sizeof...(Args)> edm::soa::Table< Args >::m_values = {{nullptr}}
private