Hyperiso
1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
IDataProvider.h
Go to the documentation of this file.
1
#ifndef IPARAMETERPROVIDER_H
2
#define IPARAMETERPROVIDER_H
3
4
#include <unordered_set>
5
#include <string>
6
#include <concepts>
7
#include <type_traits>
8
#include "
scalar.h
"
9
#include <utility>
10
52
template
<
typename
,
typename
... Args>
53
struct
has_callable_operator
: std::false_type {};
54
61
template
<
typename
T
,
typename
... Args>
62
struct
has_callable_operator
<
T
,
std
::void_t<decltype(std::declval<T>()(std::declval<Args>()...))>, Args...>
63
: std::is_convertible<decltype(std::declval<T>()(std::declval<Args>()...)), scalar_t> {};
64
65
template
<
typename
T
,
typename
... Args>
66
concept
HasCallableOperator
=
has_callable_operator
<
T
,void, Args...>::value;
67
68
template
<
typename
,
typename
... Args>
69
struct
has_exists_function
: std::false_type {};
70
77
template
<
typename
T
,
typename
... Args>
78
struct
has_exists_function
<
T
,
std
::void_t<decltype(std::declval<T>().exists(std::declval<Args>()...))>, Args...>
79
: std::is_convertible<decltype(std::declval<T>().exists(std::declval<Args>()...)), bool> {};
80
81
template
<
typename
T
,
typename
... Args>
82
concept
HasExistsFunction
=
has_exists_function
<
T
, void, Args...>::value;
83
91
template
<
typename
T>
92
class
IDataProvider
{
93
public
:
94
virtual
~IDataProvider
() =
default
;
95
96
template
<
typename
... Args>
97
requires
HasCallableOperator
<
T
, Args...>
98
double
operator()
(Args&&... args) {
99
return
static_cast<
T
*
>
(
this
)->
operator
()(std::forward<Args>(args)...);
100
}
101
102
template
<
typename
... Args>
103
requires
HasExistsFunction
<
T
, Args...>
104
bool
exists
(Args&&... args)
const
{
105
return
static_cast<
T
*
>
(
this
)->
exists
(std::forward<Args>(args)...);
106
}
107
};
108
109
110
#endif
// IPARAMETERPROVIDER_H
IDataProvider
Generic interface for providing data through callable and exist methods.
Definition
IDataProvider.h:92
IDataProvider::operator()
double operator()(Args &&... args)
Definition
IDataProvider.h:98
IDataProvider::~IDataProvider
virtual ~IDataProvider()=default
IDataProvider::exists
bool exists(Args &&... args) const
Definition
IDataProvider.h:104
HasCallableOperator
Definition
IDataProvider.h:66
HasExistsFunction
Definition
IDataProvider.h:82
std
Hash specialization for SymbolId<Tag>.
Definition
BlockName.h:353
scalar.h
T
double T(double x)
Wilson coefficient T(x).
Definition
special_SM.cpp:866
has_callable_operator
Definition
IDataProvider.h:53
has_exists_function
Definition
IDataProvider.h:69
Hyperiso
core
src
Core
ports
IDataProvider.h
Generated by
1.9.8