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 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 lumiContext::fill, edm::soa::Table< Args >::m_size, and edm::soa::Table< Args >::m_values.

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

Definition at line 153 of file Table.h.

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

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

Definition at line 158 of file Table.h.

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

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

Definition at line 162 of file Table.h.

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

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

Definition at line 167 of file Table.h.

167  : m_size(0) {
168  }
unsigned int m_size
Definition: Table.h:248
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  {
171  dtr<0>(m_values, std::true_type{});
172  }
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:249

Member Function Documentation

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

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

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

Definition at line 232 of file Table.h.

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

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

Definition at line 208 of file Table.h.

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

208  {
209  return ColumnValues<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:248
template<typename... Args>
template<typename U >
MutableColumnValues<typename U::type> edm::soa::Table< Args >::column ( )
inline

Definition at line 212 of file Table.h.

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

212  {
213  return MutableColumnValues<typename U::type>{static_cast<typename U::type*>(columnAddress<U>()), m_size};
214  }
type
Definition: HCALResponse.h:21
unsigned int m_size
Definition: Table.h:248
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 252 of file Table.h.

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

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

Definition at line 257 of file Table.h.

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

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

Definition at line 241 of file Table.h.

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

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

Definition at line 237 of file Table.h.

237  {
238  return columnAddress<U>();
239  }
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 373 of file Table.h.

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

373  {
374  using Layout = std::tuple<Args...>;
376  Type* oldPtr = static_cast<Type*>(oTo[I]);
377  Type* ptr = new Type[iNElements];
378  oTo[I]=ptr;
379  std::copy(static_cast<Type const*>(iFrom[I]), static_cast<Type const*>(iFrom[I])+iNElements, ptr);
380  delete [] oldPtr;
381  copyFromToWithResize<I+1>(iNElements, iFrom, oTo, std::conditional_t<I+1 == sizeof...(Args), std::false_type, std::true_type>{} );
382  }
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<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 384 of file Table.h.

384 {}
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 263 of file Table.h.

References Exhume::I.

263  {
265  delete [] static_cast<Type*>(iArray[I]);
266  dtr<I+1>(iArray,std::conditional_t<I+1<sizeof...(Args), std::true_type, std::false_type>{});
267  }
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 270 of file Table.h.

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

Definition at line 227 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.

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

Definition at line 233 of file Table.h.

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

233 { return iterator{m_values,size()}; }
TableItr< Args... > iterator
Definition: Table.h:142
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:249
unsigned int size() const
Definition: Table.h:184
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 174 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=().

174  {
175  Table<Args...> cp(std::move(iOther));
176  std::swap(m_size,cp.m_size);
177  std::swap(m_values, cp.m_values);
178  return *this;
179  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
unsigned int m_size
Definition: Table.h:248
std::array< void *, sizeof...(Args)> m_values
Definition: Table.h:249
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 180 of file Table.h.

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

180  {
181  return operator=( Table<Args...>(iOther));
182  }
Table< Args... > & operator=(Table< Args... > &&iOther)
Definition: Table.h:174
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 403 of file Table.h.

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

403  {
404  using Layout = std::tuple<Args...>;
406  auto ptr = static_cast<Type*>(ioArray[I]);
407  auto temp = Type{};
408  std::fill(ptr+iStartIndex, ptr+iEndIndex, temp);
409  resetStartingAt<I+1>(iStartIndex, iEndIndex, ioArray,std::conditional_t<I+1 == sizeof...(Args), std::false_type, std::true_type>{} );
410  }
type
Definition: HCALResponse.h:21
std::tuple< Args... > Layout
Definition: Table.h:140
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 413 of file Table.h.

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

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

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

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

387  {
388  using Layout = std::tuple<Args...>;
390  Type* oldPtr = static_cast<Type*>(ioArray[I]);
391  auto ptr = new Type[iNewSize];
392  auto nToCopy = std::min(iOldSize,iNewSize);
393  std::copy(static_cast<Type const*>(ioArray[I]), static_cast<Type const*>(ioArray[I])+nToCopy, ptr);
394  resizeFromTo<I+1>(iOldSize, iNewSize, ioArray, std::conditional_t<I+1 == sizeof...(Args), std::false_type, std::true_type>{} );
395 
396  delete [] oldPtr;
397  ioArray[I]=ptr;
398  }
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
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 400 of file Table.h.

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

Definition at line 216 of file Table.h.

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

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

Definition at line 219 of file Table.h.

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

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