FWCore
SOA
interface
Column.h
Go to the documentation of this file.
1
#ifndef FWCore_SOA_Column_h
2
#define FWCore_SOA_Column_h
3
// -*- C++ -*-
4
//
5
// Package: FWCore/SOA
6
// Class : Column
7
//
42
//
43
// Original Author: Chris Jones
44
// Created: Thu, 24 Aug 2017 16:17:56 GMT
45
//
46
47
// system include files
48
49
// user include files
50
51
// forward declarations
52
namespace
edm
{
53
namespace
soa
{
54
58
template
<
typename
COL,
typename
F>
59
struct
ColumnFillerHolder
{
60
using
Column_type
= COL;
61
F
m_f
;
62
};
63
64
template
<
typename
T,
typename
INHERIT>
65
struct
Column
{
66
using
type
=
T
;
67
68
static
constexpr
const
char
*
const
&
label
() {
return
INHERIT::kLabel; }
69
70
template
<
typename
F>
71
static
ColumnFillerHolder<INHERIT, F>
filler
(
F
&& iF) {
72
return
{iF};
73
}
74
75
Column
(
const
Column
&) =
delete
;
// stop default
76
77
const
Column
&
operator=
(
const
Column
&) =
delete
;
// stop default
78
79
private
:
80
Column
() =
default
;
81
};
82
83
}
// namespace soa
84
}
// namespace edm
85
86
#define SOA_DECLARE_COLUMN(_ClassName_, _Type_, _String_) \
87
struct _ClassName_ : public edm::soa::Column<_Type_, _ClassName_> { \
88
static constexpr const char* const kLabel = _String_; \
89
}
90
91
/*
92
* SOA_DECLARE_DEFAULT macro to define a default way to retrieve the column
93
* values from an arbitrary class, i.e. a templated value_for_column function.
94
* A call to the macro should be placed in edm::soa namespace.
95
*
96
* This templated value_for_column function has the advantage that
97
* value_for_column does not have to be redefined for multiple classes with a
98
* similar interface, but it has one caveat: if a different value_for_column
99
* function needs to be defined for a given class, it needs to be defined also
100
* for all derived classes, otherwise the templated value_for_column function
101
* will still be used for the derived classes.
102
*
103
* If this becomes a real problem, the SOA_DECLARE_DEFAULT can be changed to
104
* define a value_for_column_default() function, and all callers of
105
* value_for_column() check the existence of a value_for_column_default()
106
* overload first.
107
*
108
* For now, it is encouraged to adapt the interface of the class to the generic
109
* value_for_column function generated by this macro, rather than implementing
110
* value_for_column overloads for each class.
111
*/
112
#define SOA_DECLARE_DEFAULT(_ClassName_, _Expression_) \
113
template <class Object> \
114
_ClassName_::type value_for_column(Object const& x, _ClassName_*) { \
115
return x._Expression_; \
116
}
117
#endif
edm::soa::Column::label
static constexpr const char *const & label()
Definition:
Column.h:68
edm
HLT enums.
Definition:
AlignableModifier.h:19
gpuVertexFinder::soa
ZVertexSoA * soa
Definition:
gpuVertexFinder.cc:21
edm::soa::Column< int, MissingInnerHits >::type
int type
Definition:
Column.h:66
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition:
blowfish.cc:163
edm::soa::Column::filler
static ColumnFillerHolder< INHERIT, F > filler(F &&iF)
Definition:
Column.h:71
edm::soa::Column::Column
Column()=default
edm::soa::ColumnFillerHolder::m_f
F m_f
Definition:
Column.h:61
edm::soa::ColumnFillerHolder::Column_type
COL Column_type
Definition:
Column.h:60
T
long double T
Definition:
Basic3DVectorLD.h:48
edm::soa::Column
Definition:
Column.h:65
edm::soa::Column::operator=
const Column & operator=(const Column &)=delete
edm::soa::ColumnFillerHolder
Definition:
Column.h:59
Generated for CMSSW Reference Manual by
1.8.16