1 #ifndef FWCore_SOA_Table_h 2 #define FWCore_SOA_Table_h 136 template <
typename... Args>
144 template <
typename T,
typename... CArgs>
153 template<
typename T,
typename... CArgs>
155 m_size = iContainer.size();
190 if(
m_size == iNewSize) {
return;}
192 if(m_size < iNewSize) {
200 typename U::type const&
get(
size_t iRow)
const {
201 return *(
static_cast<typename
U::type const*
>(columnAddress<U>())+iRow);
205 return *(
static_cast<typename
U::type*
>(columnAddress<U>())+iRow);
218 return *(
begin()+iRow);
221 return *(
begin()+iRow);
239 return columnAddress<U>();
267 delete []
static_cast<Type*
>(iArray[
I]);
274 template<
typename T,
typename...
U>
275 static size_t fill(
std::array<
void *,
sizeof...(Args)>& oValues,
T const& iContainer,
U... iArgs) {
276 static_assert(
sizeof...(Args) ==
sizeof...(
U)+1,
"Wrong number of arguments passed to Table constructor");
277 ctrFiller<0>(oValues,iContainer.size(), iContainer,std::forward<U>(iArgs)...);
278 return iContainer.size();
281 template<
int I,
typename T,
typename...
U>
282 static void ctrFiller(
std::array<
void *,
sizeof...(Args)>& oValues,
size_t iSize, T
const& iContainer,
U... iU) {
283 assert(iContainer.size() == iSize);
285 Type *
temp =
new Type [iSize];
286 unsigned int index = 0;
287 for(
auto const&
v: iContainer) {
293 ctrFiller<I+1>(oValues, iSize, std::forward<U>(iU)... );
304 static size_t fill(
std::array<
void *,
sizeof...(Args)>& oValues, T
const& iContainer) {
305 presize<0>(oValues,iContainer.size());
307 for(
auto&& item: iContainer) {
308 fillElement<0>(item,
index,oValues);
311 return iContainer.size();
314 template<
typename T,
typename F>
316 presize<0>(oValues,iContainer.size());
318 for(
auto&& item: iContainer) {
319 fillElementUsingFiller<0>(iFiller, item,
index,oValues);
322 return iContainer.size();
330 using Layout = std::tuple<Args...>;
332 oValues[
I] =
new Type[iSize];
333 presize<I+1>(oValues,iSize);
337 template<
int I,
typename E>
340 using Layout = std::tuple<Args...>;
343 Type* pElement =
static_cast<Type*
>(oValues[
I])+iIndex;
344 *pElement = value_for_column(iItem, static_cast<ColumnType*>(
nullptr));
345 fillElement<I+1>(iItem, iIndex, oValues);
349 template<
int I,
typename E,
typename F>
352 using Layout = std::tuple<Args...>;
355 Type* pElement =
static_cast<Type*
>(oValues[
I])+iIndex;
356 *pElement = iFiller.value(iItem, static_cast<ColumnType*>(
nullptr));
357 fillElementUsingFiller<I+1>(iFiller,iItem, iIndex, oValues);
362 template<
size_t... I>
364 std::index_sequence<I...>) {
365 (copyFromToWithResize<I>(iNElements, iFrom, oTo), ...);
370 using Layout = std::tuple<Args...>;
372 Type* oldPtr =
static_cast<Type*
>(oTo[
I]);
375 std::copy(static_cast<Type const*>(iFrom[I]), static_cast<Type const*>(iFrom[I])+iNElements, ptr);
382 using Layout = std::tuple<Args...>;
384 Type* oldPtr =
static_cast<Type*
>(ioArray[
I]);
385 auto ptr =
new Type[iNewSize];
386 auto nToCopy =
std::min(iOldSize,iNewSize);
387 std::copy(static_cast<Type const*>(ioArray[I]), static_cast<Type const*>(ioArray[I])+nToCopy, ptr);
388 resizeFromTo<I+1>(iOldSize, iNewSize, ioArray );
398 using Layout = std::tuple<Args...>;
400 auto ptr =
static_cast<Type*
>(ioArray[
I]);
403 resetStartingAt<I+1>(iStartIndex, iEndIndex, ioArray);
412 template <
typename... T1,
typename... T2>
417 template <
typename T1,
typename T2>
422 template <
typename LHS,
typename E,
typename T,
typename...
U>
429 template <
typename LHS,
typename E>
435 template <
typename TABLE,
typename E>
440 template <
typename TABLE,
typename E>
446 template<
typename... Args>
static void copyFromToWithResizeAll(size_t iNElements, std::array< void *, sizeof...(Args)> const &iFrom, std::array< void *, sizeof...(Args)> &oTo, std::index_sequence< I... >)
RowView< Args... > row(size_t iRow) const
Table(Table< Args... > const &iOther)
static void resetStartingAt(size_t iStartIndex, size_t iEndIndex, std::array< void *, sizeof...(Args)> &ioArray)
void const * columnAddress() const
keep ROOT from trying to store this
typename std::conditional< std::is_same< E, T >::value, typename AddColumns< LHS, std::tuple< U... >>::type, typename RemoveColumnCheck< typename AddColumns< LHS, std::tuple< T >>::type, E, std::tuple< U... >>::type >::type type
static void fillElement(E const &iItem, size_t iIndex, std::array< void *, sizeof...(Args)> &oValues)
Table< Args... > & operator=(Table< Args... > &&iOther)
MutableColumnValues< typename U::type > column()
Table(T const &iContainer, CArgs...iArgs)
Table(T const &iContainer, ColumnFillers< CArgs... > iFiller)
static void copyFromToWithResize(size_t iNElements, std::array< void *, sizeof...(Args)> const &iFrom, std::array< void *, sizeof...(Args)> &oTo)
void resize(unsigned int iNewSize)
std::tuple< Args... > Layout
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
const std::complex< double > I
static size_t fill(std::array< void *, sizeof...(Args)> &oValues, T const &iContainer, U...iArgs)
void const * columnAddressWorkaround(U const *) const
ColumnValues< typename U::type > column() const
static size_t fill(std::array< void *, sizeof...(Args)> &oValues, T const &iContainer)
static void dtr(std::array< void *, sizeof...(Args)> &iArray)
std::array< void *, sizeof...(Args)> m_values
const_iterator end() const
Table< Args... > & operator=(Table< Args... > const &iOther)
static void presize(std::array< void *, sizeof...(Args)> &oValues, size_t iSize)
typename impl::RemoveColumnCheck< Table<>, E, typename TABLE::Layout >::type type
static void resizeFromTo(size_t iOldSize, size_t iNewSize, std::array< void *, sizeof...(Args)> &ioArray)
Table(Table< Args... > &&iOther)
static void ctrFiller(std::array< void *, sizeof...(Args)> &, size_t)
static size_t fillUsingFiller(F &iFiller, std::array< void *, sizeof...(Args)> &oValues, T const &iContainer)
MutableRowView< Args... > row(size_t iRow)
typename RemoveColumn< TABLE, E >::type RemoveColumn_t
void const * columnAddressByIndex(unsigned int iIndex) const
static void ctrFiller(std::array< void *, sizeof...(Args)> &oValues, size_t iSize, T const &iContainer, U...iU)
static std::unique_ptr< TableExaminerBase > make(const Table< Args... > *iTable)
typename AddColumns< T1, T2 >::type AddColumns_t
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
const_iterator begin() const
static constexpr const unsigned int kNColumns
static void fillElementUsingFiller(F &iFiller, E const &iItem, size_t iIndex, std::array< void *, sizeof...(Args)> &oValues)
unsigned int size() const