Reactions  0.1.1
Handling reaction trees and decays
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
reactions::fields Namespace Reference

Utilities to handle database objects and their elements. More...

Namespaces

 detail
 Internal utilitites for the reactions::fields namespace.
 

Classes

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

Typedefs

template<class Fields >
using underlying_types_t = typename underlying_types< Fields >::type
 Define a std::tuple with the types of the fields provided. More...
 
template<class T >
using remove_optional_t = typename remove_optional< T >::type
 If the input type is an optional, get the underying type. More...
 
template<class... R>
using range_collection = std::tuple< R... >
 Define a collection of ranges (a single variable with subvariables) More...
 
template<class R >
using 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 type_of_t = typename type_of< T, Subfield... >::type
 Determine a returned type. More...
 
using float_opt = std::optional< float >
 Optional for floating point type. More...
 
using double_opt = std::optional< double >
 Optional for double floating point type. More...
 
using ve_float_opt = std::optional< value_and_error< float > >
 Optional value_and_error for single-precision floating-point type. More...
 
using ve_double_opt = std::optional< value_and_error< double > >
 Optional value_and_error for double-precision floating-point type. More...
 
template<class TagType >
using vet_float_opt = std::optional< value_and_error_with_tag< float, TagType > >
 
template<class TagType >
using vet_double_opt = std::optional< value_and_error_with_tag< double, TagType > >
 
using ves_float_opt = std::optional< value_and_errors< float > >
 Optional value_and_errors for single-precision floating-point type. More...
 
using 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 field_member_type_t = typename field_member_type< Field, Subfield... >::type
 Access the subtype of a set of fields. More...
 

Enumerations

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

Functions

template<class T >
constexpr auto const & access_value (T const &c)
 
template<class T >
constexpr auto const & access_value (std::optional< T > const &opt)
 
template<class T >
value_and_error< T > 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 > 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 > 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 > 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 > 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 > operator* (T f, value_and_errors< T > const &vae)
 Multiplication of the value and errors by a constant. More...
 
template<class Range , class T >
conversion_status 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 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 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 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 to_string (T const &v)
 Convert the given object to a string. More...
 
template<>
std::string to_string (std::string const &v)
 Convert the given object to a string. More...
 

Variables

template<class T >
constexpr auto is_optional_v = is_optional<T>::value
 Alias to check if a type represents an optional. More...
 
template<class Field >
constexpr auto 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 > get
 Accessor to a value/error field. More...
 

Detailed Description

Utilities to handle database objects and their elements.

Databases return elements with fields. The template argument name Field designates an object with the following properties:

On the other hand, the members of a field can be accessed using the fields::get function, using as a template argument the structure (Subfield) that identifies the member.

The access to a value of a field (or a member of a field) is handled by units::accessor, which automatically handles the system of units and the access to members of a field. If at some point the associated type is a std::optional, the value is accessed without checking its validity.

Typedef Documentation

◆ double_opt

Optional for double floating point type.

◆ field_member_type_t

template<class Field , class... Subfield>
using reactions::fields::field_member_type_t = typedef typename field_member_type<Field, Subfield...>::type

Access the subtype of a set of fields.

◆ float_opt

Optional for floating point type.

◆ overall_range_t

template<class R >
using reactions::fields::overall_range_t = typedef typename overall_range<R>::type

Overall range of a variable (that can be a composite)

◆ range_collection

template<class... R>
using reactions::fields::range_collection = typedef std::tuple<R...>

Define a collection of ranges (a single variable with subvariables)

◆ remove_optional_t

template<class T >
using reactions::fields::remove_optional_t = typedef typename remove_optional<T>::type

If the input type is an optional, get the underying type.

◆ type_of_t

template<class T , class... Subfield>
using reactions::fields::type_of_t = typedef typename type_of<T, Subfield...>::type

Determine a returned type.

◆ underlying_types_t

template<class Fields >
using reactions::fields::underlying_types_t = typedef typename underlying_types<Fields>::type

Define a std::tuple with the types of the fields provided.

◆ ve_double_opt

Optional value_and_error for double-precision floating-point type.

◆ ve_float_opt

Optional value_and_error for single-precision floating-point type.

◆ ves_double_opt

Optional value_and_errors for double-precision floating-point type.

◆ ves_float_opt

Optional value_and_errors for single-precision floating-point type.

◆ vet_double_opt

template<class TagType >
using reactions::fields::vet_double_opt = typedef std::optional<value_and_error_with_tag<double, TagType> >

Optional value_and_error_with_tag for double-precision floating-point type

◆ vet_float_opt

template<class TagType >
using reactions::fields::vet_float_opt = typedef std::optional<value_and_error_with_tag<float, TagType> >

Optional value_and_error_with_tag for single-precision floating-point type

Enumeration Type Documentation

◆ conversion_status

Status code of a conversion to an arithmetic or std::optional type.

Enumerator
success 

the conversion succeeded

empty 

the object is missing

failed 

the conversion failed

Function Documentation

◆ access_value() [1/2]

template<class T >
constexpr auto const& reactions::fields::access_value ( T const &  c)

Return the underlying value of an object (the same if the object is std::optional)

◆ access_value() [2/2]

template<class T >
constexpr auto const& reactions::fields::access_value ( std::optional< T > const &  opt)

Return the underlying value of an object (the same if the object is std::optional)

◆ operator*() [1/6]

template<class T >
value_and_error<T> reactions::fields::operator* ( value_and_error< T > const &  vae,
f 
)

Multiplication of the value and error by a constant.

◆ operator*() [2/6]

template<class T >
value_and_error<T> reactions::fields::operator* ( f,
value_and_error< T > const &  vae 
)

Multiplication of the value and error by a constant.

◆ operator*() [3/6]

template<class V , class T >
value_and_error_with_tag<V, T> reactions::fields::operator* ( value_and_error_with_tag< V, T > const &  vae,
f 
)

Multiplication of the value and error by a constant.

◆ operator*() [4/6]

template<class V , class T >
value_and_error_with_tag<V, T> reactions::fields::operator* ( f,
value_and_error_with_tag< V, T > const &  vae 
)

Multiplication of the value and error by a constant.

◆ operator*() [5/6]

template<class T >
value_and_errors<T> reactions::fields::operator* ( value_and_errors< T > const &  vae,
f 
)

Multiplication of the value and errors by a constant.

◆ operator*() [6/6]

template<class T >
value_and_errors<T> reactions::fields::operator* ( f,
value_and_errors< T > const &  vae 
)

Multiplication of the value and errors by a constant.

◆ read_field() [1/4]

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.

◆ read_field() [2/4]

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.

◆ read_field() [3/4]

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.

◆ read_field() [4/4]

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.

◆ to_string() [1/2]

template<class T >
std::string reactions::fields::to_string ( T const &  v)

Convert the given object to a string.

◆ to_string() [2/2]

template<>
std::string reactions::fields::to_string ( std::string const &  v)

Convert the given object to a string.

Variable Documentation

◆ get

template<class Field >
constexpr get_t<Field> reactions::fields::get
static

Accessor to a value/error field.

◆ is_optional_field_v

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.

◆ is_optional_v

template<class T >
constexpr auto reactions::fields::is_optional_v = is_optional<T>::value

Alias to check if a type represents an optional.