|
ATLAS Offline Software
|
Go to the documentation of this file.
4 #ifndef PRIMATIVE_HELPERS_H
5 #define PRIMATIVE_HELPERS_H
22 template <
typename T,
typename I,
typename A,
typename S=T>
25 using rettype = decltype(
ass(std::declval<I>()));
27 return [
acc,
ass, def](
I in) -> T {
28 const auto* associated =
ass(in);
29 if (!associated)
return def;
30 return acc(*associated);
45 using ull =
unsigned long long;
46 using ul =
unsigned long;
49 template <
typename T,
typename A=defaultAccessor_t<T>>
51 using I =
typename T::input_type;
53 std::string
s =
input.source;
56 const char cz =
char(0);
58 const char sm =
short(-1);
60 case Tp::PRECISION_CUSTOM:
61 case Tp::CUSTOM:
throw std::logic_error(
"custom type unsupported");
62 case Tp::UCHAR:
c.add(
t, get<uchar,I,A>(
s,
a,cz), cz);
return;
63 case Tp::CHAR:
c.add(
t, get<char,I,A>(
s,
a,
cm),
cm);
return;
64 case Tp::USHORT:
c.add(
t, get<ushort,I,A>(
s,
a,cz), cz);
return;
65 case Tp::SHORT:
c.add(
t, get<short,I,A>(
s,
a,sm), sm);
return;
66 case Tp::UINT:
c.add(
t, get<uint,I,A>(
s,
a,0), 0);
return;
67 case Tp::INT:
c.add(
t, get<int,I,A>(
s,
a,-1), -1);
return;
68 case Tp::ULONG:
c.add(
t, get<ul,I,A>(
s,
a,0), 0);
return;
69 case Tp::LONG:
c.add(
t, get<long,I,A>(
s,
a,-1), -1);
return;
70 case Tp::ULL:
c.add(
t, get<ull,I,A>(
s,
a,0), 0);
return;
71 case Tp::LL:
c.add(
t, get<ll,I,A>(
s,
a,-1), -1);
return;
72 case Tp::HALF:
c.add(
t, get<float,I,A>(
s,
a,NAN), NAN,
h);
return;
73 case Tp::FLOAT:
c.add(
t, get<float,I,A>(
s,
a,NAN), NAN);
return;
74 case Tp::DOUBLE:
c.add(
t, get<double,I,A>(
s,
a,NAN), NAN);
return;
75 case Tp::UINT2UCHAR:
c.add(
t, get<uchar,I,A,uint>(
s,
a,0), 0);
return;
76 case Tp::INT2CHAR:
c.add(
t, get<char,I,A,int>(
s,
a,
cm),
cm);
return;
77 case Tp::UINT2USHORT:
c.add(
t, get<ushort,I,A,uint>(
s,
a,0), 0);
return;
78 case Tp::INT2SHORT:
c.add(
t, get<short,I,A,int>(
s,
a,sm), sm);
return;
79 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