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

Common operations on fields. More...

#include <algorithm>
#include <cmath>
#include <optional>
#include <string>
#include <tuple>
#include <type_traits>
Include dependency graph for fields.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::fields::underlying_types< Tuple >
 Define a std::tuple with the types of the fields provided. More...
 
struct  reactions::fields::underlying_types< std::tuple< Field... > >
 Define a std::tuple with the types of the fields provided. More...
 
struct  reactions::fields::is_optional< class >
 Check if a type represents an optional. More...
 
struct  reactions::fields::is_optional< std::optional< T > >
 Check if a type represents an optional. More...
 
struct  reactions::fields::is_optional_field< Field, Enable >
 Contain the information whether a field is optional or not. More...
 
struct  reactions::fields::is_optional_field< Field, std::enable_if_t< is_optional_v< typename Field::value_type > > >
 Contain the information whether a field is optional or not. More...
 
struct  reactions::fields::remove_optional< T >
 If the input type is an optional, get the underying type. More...
 
struct  reactions::fields::remove_optional< std::optional< T > >
 If the input type is an optional, get the underying type. More...
 
struct  reactions::fields::value
 Field for a value. More...
 
struct  reactions::fields::error
 Field for an error. More...
 
struct  reactions::fields::error_lower
 Field for a lower error. More...
 
struct  reactions::fields::error_upper
 Field for an lower error. More...
 
struct  reactions::fields::tag
 Field for a tag. More...
 
struct  reactions::fields::range< Min, Max >
 Define a range with minimum and maximum indices. More...
 
struct  reactions::fields::overall_range< R >
 Get the overall range for a range with/without subranges. More...
 
struct  reactions::fields::overall_range< range_collection< R0, R..., Rn > >
 Overall range of a variable (that can be a composite) More...
 
struct  reactions::fields::value_and_error< T, Enable >
 Simple structure composed by a value and its error. More...
 
struct  reactions::fields::value_and_error< T, std::enable_if_t< std::is_floating_point_v< T >, void > >
 Empty constructor. More...
 
struct  reactions::fields::value_and_error_with_tag< ValueType, TagType, Enable >
 Represent a value, its error and a identifier tag. More...
 
struct  reactions::fields::value_and_error_with_tag< ValueType, TagType, std::enable_if_t<(std::is_floating_point_v< ValueType > &&std::is_integral_v< TagType >), void > >
 Empty constructor. More...
 
struct  reactions::fields::value_and_errors< T, Enable >
 Simple structure composed by a value and the lower and upper errors. More...
 
struct  reactions::fields::value_and_errors< T, std::enable_if_t< std::is_floating_point_v< T >, void > >
 Empty constructor. More...
 
struct  reactions::fields::get_t< Field >
 Type defining an accessor to a value/error field. More...
 
struct  reactions::fields::get_t< value >
 Accessor to the value. More...
 
struct  reactions::fields::get_t< error >
 Accessor to the error. More...
 
struct  reactions::fields::get_t< error_lower >
 Accessor to the lower error. More...
 
struct  reactions::fields::get_t< error_upper >
 Accessor to the upper error. More...
 
struct  reactions::fields::get_t< tag >
 Accessor to the tag. More...
 
struct  reactions::fields::type_of< T, Subfield, S >
 Determine a returned type. More...
 
struct  reactions::fields::type_of< T, Subfield >
 Determine a returned type. More...
 
struct  reactions::fields::field_member_type< Field, Subfield >
 Access the subtype of a set of fields. More...
 
struct  reactions::fields::field_member_type< Field >
 Access the subtype of a set of fields. More...
 

Namespaces

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

Typedefs

template<class Fields >
using reactions::fields::underlying_types_t = typename underlying_types< Fields >::type
 Define a std::tuple with the types of the fields provided. More...
 
template<class T >
using reactions::fields::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::fields::range_collection = std::tuple< R... >
 Define a collection of ranges (a single variable with subvariables) More...
 
template<class R >
using reactions::fields::overall_range_t = typename overall_range< R >::type
 Overall range of a variable (that can be a composite) More...
 
template<class T , class... Subfield>
using reactions::fields::type_of_t = typename type_of< T, Subfield... >::type
 Determine a returned type. More...
 
using reactions::fields::float_opt = std::optional< float >
 Optional for floating point type. More...
 
using reactions::fields::double_opt = std::optional< double >
 Optional for double floating point type. More...
 
using reactions::fields::ve_float_opt = std::optional< value_and_error< float > >
 Optional value_and_error for single-precision floating-point type. More...
 
using reactions::fields::ve_double_opt = std::optional< value_and_error< double > >
 Optional value_and_error for double-precision floating-point type. More...
 
template<class TagType >
using reactions::fields::vet_float_opt = std::optional< value_and_error_with_tag< float, TagType > >
 
template<class TagType >
using reactions::fields::vet_double_opt = std::optional< value_and_error_with_tag< double, TagType > >
 
using reactions::fields::ves_float_opt = std::optional< value_and_errors< float > >
 Optional value_and_errors for single-precision floating-point type. More...
 
using reactions::fields::ves_double_opt = std::optional< value_and_errors< double > >
 Optional value_and_errors for double-precision floating-point type. More...
 
template<class Field , class... Subfield>
using reactions::fields::field_member_type_t = typename field_member_type< Field, Subfield... >::type
 Access the subtype of a set of fields. More...
 

Enumerations

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

Functions

template<class T >
constexpr auto const & reactions::fields::access_value (T const &c)
 
template<class T >
constexpr auto const & reactions::fields::access_value (std::optional< T > const &opt)
 
template<class T >
value_and_error< T > reactions::fields::operator* (value_and_error< T > const &vae, T f)
 Multiplication of the value and error by a constant. More...
 
template<class T >
value_and_error< T > reactions::fields::operator* (T f, value_and_error< T > const &vae)
 Multiplication of the value and error by a constant. More...
 
template<class V , class T >
value_and_error_with_tag< V, T > reactions::fields::operator* (value_and_error_with_tag< V, T > const &vae, V f)
 Multiplication of the value and error by a constant. More...
 
template<class V , class T >
value_and_error_with_tag< V, T > reactions::fields::operator* (V f, value_and_error_with_tag< V, T > const &vae)
 Multiplication of the value and error by a constant. More...
 
template<class T >
value_and_errors< T > reactions::fields::operator* (value_and_errors< T > const &vae, T f)
 Multiplication of the value and errors by a constant. More...
 
template<class T >
value_and_errors< T > reactions::fields::operator* (T f, value_and_errors< T > const &vae)
 Multiplication of the value and errors by a constant. More...
 
conversion_status reactions::fields::detail::string_to_type (int &out, std::string const &s)
 Convert a range of characters to an integral. More...
 
conversion_status reactions::fields::detail::string_to_type (float &out, std::string const &s)
 Convert a range of characters to a floating point. More...
 
conversion_status reactions::fields::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::fields::detail::string_to_type (bool &out, std::string const &s)
 Convert a range of characters to a boolean. More...
 
conversion_status reactions::fields::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::fields::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::fields::read_field (value_and_error< T > &out, std::string const &s)
 Read a field composed by value and an error in a line from a file. More...
 
template<class Ranges , class ValueType , class TagType >
conversion_status reactions::fields::read_field (value_and_error_with_tag< ValueType, TagType > &out, std::string const &s)
 Read a field composed by value and an error in a line from a file. More...
 
template<class Ranges , class T >
conversion_status reactions::fields::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...
 
template<class T >
std::string reactions::fields::to_string (T const &v)
 Convert the given object to a string. More...
 
template<>
std::string reactions::fields::to_string (std::string const &v)
 Convert the given object to a string. 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::fields::is_optional_v = is_optional<T>::value
 Alias to check if a type represents an optional. More...
 
template<class Field >
constexpr auto reactions::fields::is_optional_field_v = is_optional_field<Field>::value
 Contain the information whether a field is optional or not. More...
 
template<class Field >
static constexpr get_t< Field > reactions::fields::get
 Accessor to a value/error field. More...
 

Detailed Description

Common operations on fields.