|
ATLAS Offline Software
|
Go to the documentation of this file.
4 #ifndef PRIMATIVE_HELPERS_H
5 #define PRIMATIVE_HELPERS_H
21 template <
typename T,
typename I,
typename A,
typename S=T>
24 using rettype = decltype(
ass(std::declval<I>()));
26 return [
acc,
ass, def](
I in) -> T {
27 const auto* associated =
ass(in);
28 if (!associated)
return def;
29 return acc(*associated);
44 using ull =
unsigned long long;
45 using ul =
unsigned long;
48 template <
typename T,
typename A=defaultAccessor_t<T>>
50 using I =
typename T::input_type;
52 std::string
s =
input.source;
55 const char cz =
char(0);
57 const char sm =
short(-1);
59 case Tp::PRECISION_CUSTOM:
60 case Tp::CUSTOM:
throw std::logic_error(
"custom type unsupported");
61 case Tp::UCHAR:
c.add(
t, get<uchar,I,A>(
s,
a,cz), cz);
return;
62 case Tp::CHAR:
c.add(
t, get<char,I,A>(
s,
a,
cm),
cm);
return;
63 case Tp::USHORT:
c.add(
t, get<ushort,I,A>(
s,
a,cz), cz);
return;
64 case Tp::SHORT:
c.add(
t, get<short,I,A>(
s,
a,sm), sm);
return;
65 case Tp::UINT:
c.add(
t, get<uint,I,A>(
s,
a,0), 0);
return;
66 case Tp::INT:
c.add(
t, get<int,I,A>(
s,
a,-1), -1);
return;
67 case Tp::ULONG:
c.add(
t, get<ul,I,A>(
s,
a,0), 0);
return;
68 case Tp::LONG:
c.add(
t, get<long,I,A>(
s,
a,-1), -1);
return;
69 case Tp::ULL:
c.add(
t, get<ull,I,A>(
s,
a,0), 0);
return;
70 case Tp::LL:
c.add(
t, get<ll,I,A>(
s,
a,-1), -1);
return;
71 case Tp::HALF:
c.add(
t, get<float,I,A>(
s,
a,NAN), NAN,
h);
return;
72 case Tp::FLOAT:
c.add(
t, get<float,I,A>(
s,
a,NAN), NAN);
return;
73 case Tp::DOUBLE:
c.add(
t, get<double,I,A>(
s,
a,NAN), NAN);
return;
74 case Tp::UINT2UCHAR:
c.add(
t, get<uchar,I,A,uint>(
s,
a,0), 0);
return;
75 case Tp::INT2CHAR:
c.add(
t, get<char,I,A,int>(
s,
a,
cm),
cm);
return;
76 case Tp::UINT2USHORT:
c.add(
t, get<ushort,I,A,uint>(
s,
a,0), 0);
return;
77 case Tp::INT2SHORT:
c.add(
t, get<short,I,A,int>(
s,
a,sm), sm);
return;
78 case Tp::UL2ULL:
c.add(
t, get<ull,I,A,ul>(
s,
a,0),0);
return;
void addInput(T &c, const Primitive &input, A a=defaultAccessor< T >)
Helper class to provide constant type-safe access to aux data.
std::function< T(I)> get(std::string source, A ass, T def)
bool isCustom(const Primitive &p)
decltype(defaultAccessor< T >) defaultAccessor_t
Base class for elements of a container that can have aux data.
make the histogram assessment part of the config