CMS 3D CMS Logo

TableExaminer.h
Go to the documentation of this file.
1 #ifndef FWCore_SOA_TableExaminer_h
2 #define FWCore_SOA_TableExaminer_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/SOA
6 // Class : TableExaminer
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Mon, 28 Aug 2017 14:22:29 GMT
19 //
20 
21 // system include files
22 
23 // user include files
25 
26 // forward declarations
27 namespace edm {
28  namespace soa {
29 
30  template <typename T>
32  public:
33  explicit TableExaminer(T const* iTable) : m_table(iTable) {}
34 
35  TableExaminer(const TableExaminer<T>&) = default;
36 
37  TableExaminer<T>& operator=(const TableExaminer<T>&) = default;
38 
39  ~TableExaminer() override {}
40 
41  // ---------- const member functions ---------------------
42 
43  size_t size() const final { return m_table->size(); }
44 
45  void const* columnAddress(unsigned int iColumnIndex) const final {
46  return m_table->columnAddressByIndex(iColumnIndex);
47  }
48 
49  std::vector<std::type_index> columnTypes() const final {
50  std::vector<std::type_index> returnValue;
51  returnValue.reserve(T::kNColumns);
52  columnTypesImpl<0, T::kNColumns>(returnValue);
53  return returnValue;
54  }
55 
56  std::vector<std::pair<char const*, std::type_index>> columnDescriptions() const final {
57  std::vector<std::pair<char const*, std::type_index>> returnValue;
58  returnValue.reserve(T::kNColumns);
59  columnDescImpl<0, T::kNColumns>(returnValue);
60  return returnValue;
61  }
62 
63  const std::type_info* typeID() const final { return &typeid(T); }
64 
65  private:
66  template <int I, int S>
67  void columnTypesImpl(std::vector<std::type_index>& iV) const {
68  if constexpr (I != S) {
69  using Layout = typename T::Layout;
70  iV.emplace_back(typeid(typename std::tuple_element<I, Layout>::type));
71  columnTypesImpl<I + 1, S>(iV);
72  }
73  }
74 
75  template <int I, int S>
76  void columnDescImpl(std::vector<std::pair<char const*, std::type_index>>& iV) const {
77  if constexpr (I != S) {
78  using Layout = typename T::Layout;
79  using ColumnType = typename std::tuple_element<I, Layout>::type;
80  iV.emplace_back(ColumnType::label(), typeid(typename ColumnType::type));
81  columnDescImpl<I + 1, S>(iV);
82  }
83  }
84 
85  // ---------- member data --------------------------------
86  T const* m_table;
87  };
88 
89  } // namespace soa
90 } // namespace edm
91 
92 #endif
edm::soa::TableExaminer::columnDescriptions
std::vector< std::pair< char const *, std::type_index > > columnDescriptions() const final
Definition: TableExaminer.h:56
edm::soa::TableExaminer::operator=
TableExaminer< T > & operator=(const TableExaminer< T > &)=default
edm::soa::TableExaminerBase
Definition: TableExaminerBase.h:34
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::soa::TableExaminer::size
size_t size() const final
Definition: TableExaminer.h:43
watchdog.const
const
Definition: watchdog.py:83
edm::soa::TableExaminer::columnDescImpl
void columnDescImpl(std::vector< std::pair< char const *, std::type_index >> &iV) const
Definition: TableExaminer.h:76
edm::soa::TableExaminer::columnTypes
std::vector< std::type_index > columnTypes() const final
Definition: TableExaminer.h:49
Exhume::I
const std::complex< double > I
Definition: I.h:8
edm::soa::TableExaminer::TableExaminer
TableExaminer(T const *iTable)
Definition: TableExaminer.h:33
edm::soa::TableExaminer
Definition: TableExaminer.h:31
edm::soa::TableExaminer::typeID
const std::type_info * typeID() const final
Definition: TableExaminer.h:63
type
type
Definition: HCALResponse.h:21
edm::soa::TableExaminer::m_table
T const * m_table
Definition: TableExaminer.h:86
edm::soa::TableExaminer::columnAddress
void const * columnAddress(unsigned int iColumnIndex) const final
Definition: TableExaminer.h:45
T
long double T
Definition: Basic3DVectorLD.h:48
kNColumns
static const unsigned int kNColumns
Definition: FWGUIEventDataAdder.cc:69
S
Definition: CSCDBL1TPParametersExtended.h:16
edm::soa::TableExaminer::columnTypesImpl
void columnTypesImpl(std::vector< std::type_index > &iV) const
Definition: TableExaminer.h:67
TableExaminerBase.h
edm::soa::TableExaminer::~TableExaminer
~TableExaminer() override
Definition: TableExaminer.h:39
label
const char * label
Definition: PFTauDecayModeTools.cc:11