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, std::true_type)
 
template<int I>
static void copyFromToWithResize (size_t, std::array< void *, sizeof...(Args)> const &, std::array< void *, sizeof...(Args)> &, std::false_type)
 
template<int I>
static void dtr (std::array< void *, sizeof...(Args)> &iArray, std::true_type)
 
template<int I>
static void dtr (std::array< void *, sizeof...(Args)> &iArray, std::false_type)
 
template<int I>
static void resetStartingAt (size_t iStartIndex, size_t iEndIndex, std::array< void *, sizeof...(Args)> &ioArray, std::true_type)
 
template<int I>
static void resetStartingAt (size_t, size_t, std::array< void *, sizeof...(Args)> &, std::false_type)
 
template<int I>
static void resizeFromTo (size_t iOldSize, size_t iNewSize, std::array< void *, sizeof...(Args)> &ioArray, std::true_type)
 
template<int I>
static void resizeFromTo (size_t, size_t, std::array< void *, sizeof...(Args)> &, std::false_type)
 

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 136 of file Table.h.

Member Typedef Documentation

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

Definition at line 140 of file Table.h.

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

Definition at line 141 of file Table.h.

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

Definition at line 139 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 144 of file Table.h.

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

144  : m_size(iContainer.size()) {
145  using CtrChoice = std::conditional_t<sizeof...(CArgs)==0,
146  CtrFillerFromAOS,
147  CtrFillerFromContainers>;
148  m_size = CtrChoice::fill(m_values,iContainer,std::forward<CArgs>(iArgs)...);
149  }
unsigned int m_size
Definition: Table.h:247
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:248
template<typename... Args>
template<typename T , typename... CArgs>
edm::soa::Table< Args >::Table ( T const &  iContainer,
ColumnFillers< CArgs... >  iFiller 
)
inline

Definition at line 152 of file Table.h.

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

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

Definition at line 157 of file Table.h.

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

157  :m_size(iOther.m_size), m_values{{nullptr}} {
158  copyFromToWithResize<0>(m_size,iOther.m_values,m_values,std::true_type{});
159  }
unsigned int m_size
Definition: Table.h:247
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:248
template<typename... Args>
edm::soa::Table< Args >::Table ( Table< Args... > &&  iOther)
inline

Definition at line 161 of file Table.h.

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

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

Definition at line 166 of file Table.h.

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

Definition at line 169 of file Table.h.

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

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

Member Function Documentation

template<typename... Args>
const_iterator edm::soa::Table< Args >::begin ( 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 lumiQTWidget::t.

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

222  {
223  std::array<void const*, sizeof...(Args)> t;
224  for(size_t i = 0; i<size();++i) { t[i] = m_values[i]; }
225  return const_iterator{t}; }
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:248
ConstTableItr< Args... > const_iterator
Definition: Table.h:140
unsigned int size() const
Definition: Table.h:183
template<typename... Args>
iterator edm::soa::Table< Args >::begin ( void  )
inline

Definition at line 231 of file Table.h.

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

231 { return iterator{m_values}; }
TableItr< Args... > iterator
Definition: Table.h:141
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:248
template<typename... Args>
template<typename U >
ColumnValues<typename U::type> edm::soa::Table< Args >::column ( ) const
inline

Definition at line 207 of file Table.h.

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

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

Definition at line 211 of file Table.h.

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

211  {
212  return MutableColumnValues<typename U::type>{static_cast<typename U::type*>(columnAddress<U>()), m_size};
213  }
type
Definition: HCALResponse.h:21
unsigned int m_size
Definition: Table.h:247
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 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:248
template<typename... Args>
template<typename U >
void* edm::soa::Table< Args >::columnAddress ( )
inlineprivate

Definition at line 256 of file Table.h.

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

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

Definition at line 240 of file Table.h.

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

240  {
241  return m_values[iIndex];
242  }
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:248
template<typename... Args>
template<typename U >
void const* edm::soa::Table< Args >::columnAddressWorkaround ( U const *  ) const
inline

Definition at line 236 of file Table.h.

236  {
237  return columnAddress<U>();
238  }
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,
std::true_type   
)
inlinestaticprivate

Definition at line 372 of file Table.h.

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

372  {
373  using Layout = std::tuple<Args...>;
375  Type* oldPtr = static_cast<Type*>(oTo[I]);
376  Type* ptr = new Type[iNElements];
377  oTo[I]=ptr;
378  std::copy(static_cast<Type const*>(iFrom[I]), static_cast<Type const*>(iFrom[I])+iNElements, ptr);
379  delete [] oldPtr;
380  copyFromToWithResize<I+1>(iNElements, iFrom, oTo, std::conditional_t<I+1 == sizeof...(Args), std::false_type, std::true_type>{} );
381  }
type
Definition: HCALResponse.h:21
std::tuple< Args... > Layout
Definition: Table.h:139
const std::complex< double > I
Definition: I.h:8
template<typename... Args>
template<int I>
static void edm::soa::Table< Args >::copyFromToWithResize ( size_t  ,
std::array< void *, sizeof...(Args)> const &  ,
std::array< void *, sizeof...(Args)> &  ,
std::false_type   
)
inlinestaticprivate

Definition at line 383 of file Table.h.

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

Definition at line 262 of file Table.h.

References Exhume::I.

262  {
264  delete [] static_cast<Type*>(iArray[I]);
265  dtr<I+1>(iArray,std::conditional_t<I+1<sizeof...(Args), std::true_type, std::false_type>{});
266  }
type
Definition: HCALResponse.h:21
const std::complex< double > I
Definition: I.h:8
template<typename... Args>
template<int I>
static void edm::soa::Table< Args >::dtr ( std::array< void *, sizeof...(Args)> &  iArray,
std::false_type   
)
inlinestaticprivate

Definition at line 269 of file Table.h.

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

Definition at line 226 of file Table.h.

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

226  {
227  std::array<void const*, sizeof...(Args)> t;
228  for(size_t i = 0; i<size();++i) { t[i] = m_values[i]; }
229  return const_iterator{t,size()}; }
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:248
ConstTableItr< Args... > const_iterator
Definition: Table.h:140
unsigned int size() const
Definition: Table.h:183
template<typename... Args>
iterator edm::soa::Table< Args >::end ( void  )
inline

Definition at line 232 of file Table.h.

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

232 { return iterator{m_values,size()}; }
TableItr< Args... > iterator
Definition: Table.h:141
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:248
unsigned int size() const
Definition: Table.h:183
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 173 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().

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

173  {
174  Table<Args...> cp(std::move(iOther));
175  std::swap(m_size,cp.m_size);
176  std::swap(m_values, cp.m_values);
177  return *this;
178  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
unsigned int m_size
Definition: Table.h:247
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:248
def move(src, dest)
Definition: eostools.py:510
template<typename... Args>
Table<Args...>& edm::soa::Table< Args >::operator= ( Table< Args... > const &  iOther)
inline

Definition at line 179 of file Table.h.

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

179  {
180  return operator=( Table<Args...>(iOther));
181  }
Table< Args... > & operator=(Table< Args... > &&iOther)
Definition: Table.h:173
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,
std::true_type   
)
inlinestaticprivate

Definition at line 402 of file Table.h.

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

402  {
403  using Layout = std::tuple<Args...>;
405  auto ptr = static_cast<Type*>(ioArray[I]);
406  auto temp = Type{};
407  std::fill(ptr+iStartIndex, ptr+iEndIndex, temp);
408  resetStartingAt<I+1>(iStartIndex, iEndIndex, ioArray,std::conditional_t<I+1 == sizeof...(Args), std::false_type, std::true_type>{} );
409  }
type
Definition: HCALResponse.h:21
std::tuple< Args... > Layout
Definition: Table.h:139
const std::complex< double > I
Definition: I.h:8
template<typename... Args>
template<int I>
static void edm::soa::Table< Args >::resetStartingAt ( size_t  ,
size_t  ,
std::array< void *, sizeof...(Args)> &  ,
std::false_type   
)
inlinestaticprivate

Definition at line 412 of file Table.h.

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

Definition at line 187 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().

187  {
188  if(m_size == iNewSize) { return;}
189  resizeFromTo<0>(m_size,iNewSize,m_values,std::true_type{});
190  if(m_size < iNewSize) {
191  //initialize the extra values
192  resetStartingAt<0>(m_size, iNewSize,m_values,std::true_type{});
193  }
194  m_size = iNewSize;
195  }
unsigned int m_size
Definition: Table.h:247
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:248
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,
std::true_type   
)
inlinestaticprivate

Definition at line 386 of file Table.h.

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

386  {
387  using Layout = std::tuple<Args...>;
389  Type* oldPtr = static_cast<Type*>(ioArray[I]);
390  auto ptr = new Type[iNewSize];
391  auto nToCopy = std::min(iOldSize,iNewSize);
392  std::copy(static_cast<Type const*>(ioArray[I]), static_cast<Type const*>(ioArray[I])+nToCopy, ptr);
393  resizeFromTo<I+1>(iOldSize, iNewSize, ioArray, std::conditional_t<I+1 == sizeof...(Args), std::false_type, std::true_type>{} );
394 
395  delete [] oldPtr;
396  ioArray[I]=ptr;
397  }
type
Definition: HCALResponse.h:21
std::tuple< Args... > Layout
Definition: Table.h:139
const std::complex< double > I
Definition: I.h:8
T min(T a, T b)
Definition: MathUtil.h:58
template<typename... Args>
template<int I>
static void edm::soa::Table< Args >::resizeFromTo ( size_t  ,
size_t  ,
std::array< void *, sizeof...(Args)> &  ,
std::false_type   
)
inlinestaticprivate

Definition at line 399 of file Table.h.

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

Definition at line 215 of file Table.h.

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

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

Definition at line 218 of file Table.h.

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

218  {
219  return *(begin()+iRow);
220  }
const_iterator begin() const
Definition: Table.h:222
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 138 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