Reactions  0.0.0
Handling reaction trees and decays
Classes | Namespaces | Typedefs | Enumerations | Functions | Variables
database.hpp File Reference

Common operations on databases. More...

#include <algorithm>
#include <cmath>
#include <optional>
#include <stdexcept>
#include <string>
#include <tuple>
#include <type_traits>
Include dependency graph for database.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  reactions::fill< Args >
 Small structure to define fields without explicitely knowing its type. More...
 
struct  reactions::database::underlying_types< Tuple >
 Define a std::tuple with the types of the fields provided. More...
 
struct  reactions::database::underlying_types< std::tuple< F... > >
 Define a std::tuple with the types of the fields provided. More...
 
struct  reactions::database::is_optional< class >
 Check if a type represents an optional. More...
 
struct  reactions::database::is_optional< std::optional< T > >
 Check if a type represents an optional. More...
 
struct  reactions::database::is_optional_field< F, Enable >
 Contain the information whether a field is optional or not. More...
 
struct  reactions::database::is_optional_field< F, std::enable_if_t< is_optional_v< typename F::value_type > > >
 Contain the information whether a field is optional or not. More...
 
struct  reactions::database::remove_optional< T >
 If the input type is an optional, get the underying type. More...
 
struct  reactions::database::remove_optional< std::optional< T > >
 If the input type is an optional, get the underying type. More...
 
struct  reactions::database::value
 Field for a value. More...
 
struct  reactions::database::error
 Field for an error. More...
 
struct  reactions::database::error_lower
 Field for a lower error. More...
 
struct  reactions::database::error_upper
 Field for an lower error. More...
 
struct  reactions::database::range< Min, Max >
 Define a range with minimum and maximum indices. More...
 
struct  reactions::database::overall_range< R >
 Get the overall range for a range with/without subranges. More...
 
struct  reactions::database::overall_range< range_collection< R0, R..., Rn > >
 Overall range of a variable (that can be a composite) More...
 
struct  reactions::database::value_and_errors< T, Enable >
 Simple structure composed by a value and the lower and upper errors. More...
 
struct  reactions::database::value_and_errors< T, std::enable_if_t< std::is_floating_point_v< T >, void > >
 Empty constructor. More...
 
struct  reactions::database::get_t< F >
 Type defining an accessor to a value/error field. More...
 
struct  reactions::database::get_t< value >
 Accessor to the value. More...
 
struct  reactions::database::get_t< error >
 Accessor to the error. More...
 
struct  reactions::database::get_t< error_lower >
 Accessor to the lower error. More...
 
struct  reactions::database::get_t< error_upper >
 Accessor to the upper error. More...
 

Namespaces

 reactions
 Main namespace of the Reactions package.
 
 reactions::database
 Utilities to handle database objects and their elements.
 
 reactions::database::detail
 Internal utilitites for the reactions::database namespace.
 

Typedefs

template<class T >
using reactions::database::remove_optional_t = typename remove_optional< T >::type
 If the input type is an optional, get the underying type. More...
 
template<class... R>
using reactions::database::range_collection = std::tuple< R... >
 Define a collection of ranges (a single variable with subvariables) More...
 
template<class R >
using reactions::database::overall_range_t = typename overall_range< R >::type
 Overall range of a variable (that can be a composite) More...
 
using reactions::database::float_opt = std::optional< float >
 Optional for float type. More...
 
using reactions::database::double_opt = std::optional< double >
 Optional for double type. More...
 
using reactions::database::ve_float_opt = std::optional< value_and_errors< float > >
 Optional value_and_errors for single-precision floating-point type. More...
 
using reactions::database::ve_double_opt = std::optional< value_and_errors< double > >
 Optional value_and_errors for double-precision floating-point type. More...
 

Enumerations

enum  reactions::database::conversion_status : int { reactions::database::success, reactions::database::empty, reactions::database::failed }
 Status code of a conversion to an arithmetic or std::optional type. More...
 

Functions

template<class T >
constexpr auto const & reactions::database::access_value (T const &c)
 
template<class T >
constexpr auto const & reactions::database::access_value (std::optional< T > const &opt)
 
conversion_status reactions::database::detail::string_to_type (int &out, std::string const &s)
 Convert a range of characters to an integral. More...
 
conversion_status reactions::database::detail::string_to_type (float &out, std::string const &s)
 Convert a range of characters to a floating point. More...
 
conversion_status reactions::database::detail::string_to_type (double &out, std::string const &s)
 Convert a range of characters to a floating point (double precision) More...
 
conversion_status reactions::database::detail::string_to_type (bool &out, std::string const &s)
 Convert a range of characters to a boolean. More...
 
conversion_status reactions::database::detail::string_to_type (std::string &out, std::string const &s)
 Convert a range of characters to string. More...
 
template<class Range , class T >
conversion_status reactions::database::read_field (T &out, std::string const &s)
 Read a field in a line from a file. More...
 
template<class Ranges , class T >
conversion_status reactions::database::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. More...
 

Variables

static constexpr auto reactions::missing = std::nullopt
 Static object that defines a missing field within an object. More...
 
template<class T >
constexpr auto reactions::database::is_optional_v = is_optional<T>::value
 Alias to check if a type represents an optional. More...
 
template<class F >
constexpr auto reactions::database::is_optional_field_v = is_optional_field<F>::value
 Contain the information whether a field is optional or not. More...
 
template<class F >
static constexpr get_t< F > reactions::database::get
 Accessor to a value/error field. More...
 

Detailed Description

Common operations on databases.