25 constexpr
fill(Args &&... args) :
base_type{std::forward<Args>(args)...} {}
29 static constexpr
auto missing = std::nullopt;
53 template <
class F,
class Enable =
void>
59 F, std::enable_if_t<is_optional_v<typename F::value_type>>>
88 template <std::
size_t Min, std::
size_t Max>
struct range {
89 static constexpr
auto min = Min, max = Max;
101 template <
class R0,
class... R,
class Rn>
115 std::enable_if_t<std::is_floating_point_v<T>, void>> {
122 template <
class Value,
class ErrorLower,
class ErrorUpper>
124 ErrorUpper &&error_upper_)
127 template <
class Value,
class ErrorLower,
class ErrorUpper>
140 return error_lower * error_lower + error_upper * error_upper;
163 template <
class T> constexpr
auto const &
operator()(T
const &t)
const {
170 template <
class T> constexpr
auto const &
operator()(T
const &t)
const {
177 template <
class T> constexpr
auto const &
operator()(T
const &t)
const {
184 template <
class T> constexpr
auto const &
operator()(T
const &t)
const {
284 template <
class Range,
class T>
299 template <
class Ranges,
class T>
303 static_assert(std::tuple_size_v<Ranges> == 3);
307 if (b >= std::tuple_element_t<2, Ranges>::max)
311 out.value, s.
substr(std::tuple_element_t<0, Ranges>::min,
312 std::tuple_element_t<0, Ranges>::max));
314 out.error_lower, s.
substr(std::tuple_element_t<1, Ranges>::min,
315 std::tuple_element_t<1, Ranges>::max));
317 out.error_upper, s.
substr(std::tuple_element_t<2, Ranges>::min,
318 std::tuple_element_t<2, Ranges>::max));
320 if (value_sc ==
empty || error_lower_sc ==
empty || error_upper_sc ==
empty)
322 else if (value_sc ==
failed || error_lower_sc ==
failed ||
T find_first_not_of(T... args)
Define a range with minimum and maximum indices.
Definition: database.hpp:88
static constexpr get_t< F > get
Accessor to a value/error field.
Definition: database.hpp:190
constexpr fill(Args &&... args)
Definition: database.hpp:25
static constexpr auto missing
Static object that defines a missing field within an object.
Definition: database.hpp:29
typename remove_optional< T >::type remove_optional_t
If the input type is an optional, get the underying type.
Definition: database.hpp:76
constexpr auto is_optional_field_v
Contain the information whether a field is optional or not.
Definition: database.hpp:64
conversion_status string_to_type(std::string &out, std::string const &s)
Convert a range of characters to string.
Definition: database.hpp:272
T type
Definition: database.hpp:67
constexpr auto is_optional_v
Alias to check if a type represents an optional.
Definition: database.hpp:50
T type
Definition: database.hpp:71
value_type error_squared() const
Calculate the squared error from the lower and upper errors.
Definition: database.hpp:139
value_type error_upper
Upper error.
Definition: database.hpp:137
Type defining an accessor to a value/error field.
Definition: database.hpp:159
value_and_errors(fill< Value, ErrorLower, ErrorUpper > &&f)
Build the class from a field constant expression.
Definition: database.hpp:128
Small structure to define fields without explicitely knowing its type.
Definition: database.hpp:22
constexpr auto const & operator()(T const &t) const
Definition: database.hpp:184
constexpr auto const & operator()(T const &t) const
Definition: database.hpp:163
value_and_errors(Value &&value_, ErrorLower &&error_lower_, ErrorUpper &&error_upper_)
Build the class with forwarded arguments.
Definition: database.hpp:123
conversion_status
Status code of a conversion to an arithmetic or std::optional type.
Definition: database.hpp:202
Simple structure composed by a value and the lower and upper errors.
Definition: database.hpp:110
constexpr auto const & operator()(T const &t) const
Definition: database.hpp:170
T value_type
Definition: database.hpp:117
Check if a type represents an optional.
Definition: database.hpp:44
value_type error() const
Calculate the error from the lower and upper errors.
Definition: database.hpp:143
Field for an lower error.
Definition: database.hpp:85
the conversion failed
Definition: database.hpp:205
Main namespace of the Reactions package.
Definition: all.hpp:21
Utilities to handle database objects and their elements.
Definition: database.hpp:33
constexpr auto const & access_value(std::optional< T > const &opt)
Definition: database.hpp:154
Get the overall range for a range with/without subranges.
Definition: database.hpp:96
conversion_status read_field(value_and_errors< T > &out, std::string const &s)
Read a field composed by value and errors in a line from a file.
Definition: database.hpp:300
T find_last_not_of(T... args)
value_type error_lower
Lower error.
Definition: database.hpp:135
If the input type is an optional, get the underying type.
Definition: database.hpp:67
the object is missing
Definition: database.hpp:204
Define a std::tuple with the types of the fields provided.
Definition: database.hpp:36
typename overall_range< R >::type overall_range_t
Overall range of a variable (that can be a composite)
Definition: database.hpp:107
Field for a value.
Definition: database.hpp:79
value_type value
Value.
Definition: database.hpp:133
constexpr auto const & operator()(T const &t) const
Definition: database.hpp:177
Field for an error.
Definition: database.hpp:81
the conversion succeeded
Definition: database.hpp:203
Contain the information whether a field is optional or not.
Definition: database.hpp:54
Field for a lower error.
Definition: database.hpp:83