libwreport
3.29
wreport
options.h
Go to the documentation of this file.
1
#ifndef WREPORT_OPTIONS_H
2
#define WREPORT_OPTIONS_H
3
4
#include <cstdint>
5
22
#define WREPORT_OPTIONS_HAS_VAR_CLAMP_DOMAIN_ERRORS
24
#define WREPORT_OPTIONS_HAS_VAR_HOOK_DOMAIN_ERRORS
25
26
namespace
wreport
{
27
class
Var;
28
29
namespace
options {
30
37
extern
thread_local
bool
var_silent_domain_errors
;
38
46
extern
thread_local
bool
var_clamp_domain_errors
;
47
52
struct
DomainErrorHook
53
{
54
virtual
~
DomainErrorHook
();
55
virtual
void
handle_domain_error_int(
Var
& var, int32_t val) = 0;
56
virtual
void
handle_domain_error_double(
Var
& var,
double
val) = 0;
57
};
58
66
extern
thread_local
DomainErrorHook
*
var_hook_domain_errors
;
67
83
template
<
typename
T,
typename
T1 = T>
84
struct
LocalOverride
85
{
86
T old_value;
87
T& param;
88
89
LocalOverride
(T& param, T1 new_value)
90
: old_value(param), param(param)
91
{
92
param = new_value;
93
}
94
~
LocalOverride
()
95
{
96
param = old_value;
97
}
98
};
99
100
template
<
typename
T,
typename
T1 = T>
static
inline
LocalOverride<T>
local_override(T& param, T1 new_value)
101
{
102
return
LocalOverride<T>
(param, new_value);
103
}
104
105
}
106
}
107
108
#endif
wreport::options::var_silent_domain_errors
thread_local bool var_silent_domain_errors
Whether domain errors on Var assignments raise exceptions.
wreport::options::var_hook_domain_errors
thread_local DomainErrorHook * var_hook_domain_errors
If set, delegate handling domain errors to this object.
wreport::options::LocalOverride
Temporarily override a variable while this object is in scope.
Definition:
options.h:85
wreport::options::DomainErrorHook
Interface for a callback hook system to delegate handling domain errors to the code using wreport.
Definition:
options.h:53
wreport::Var
A physical variable.
Definition:
var.h:25
wreport::options::var_clamp_domain_errors
thread_local bool var_clamp_domain_errors
Whether domain errors on Var assignments raise exceptions.
wreport
String functions.
Definition:
benchmark.h:13
Generated on Wed Mar 24 2021 17:29:26 for libwreport by
1.8.20