Reactions  0.1.1
Handling reaction trees and decays
element_traits.hpp
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "reactions/nubase.hpp"
7 #include "reactions/pdg.hpp"
8 
9 #include <functional>
10 #include <string>
11 
12 namespace reactions {
15 } // namespace reactions
16 
20 
22  template <class T> struct properties;
23 
25  template <> struct properties<reactions::pdg_element> {
27  static constexpr auto builder = [](std::string const &s) {
29  };
30  };
31 
33  template <> struct properties<reactions::nubase_element> {
35  static constexpr auto builder = [](std::string const &s) {
37  };
38  };
39 
41  template <> struct properties<reactions::string_element> {
43  static constexpr auto builder = [](std::string const &s) { return s; };
44  };
45 
47  template <class T> using element_t = typename properties<T>::type;
48 
50  template <class T> static constexpr auto builder = properties<T>::builder;
51 
53  template <class T> using builder_t = decltype(builder<T>);
54 
56  template <class T>
58 } // namespace reactions::element_traits
A PDG particle, based on the fields of a particle in the PDG database.
Definition: pdg.hpp.in:138
Define properties for a given element kind.
Definition: element_traits.hpp:22
std::string string_element
Alias for an element based on a simple string.
Definition: element_traits.hpp:14
static pdg_database & instance()
Get the only instance of this class.
Definition: pdg.hpp.in:621
STL class.
static constexpr auto builder
Default builder for a given kind of element.
Definition: element_traits.hpp:50
std::function< T(std::string const &)> const & builder_tpl_t
General builder type for a given kind of element.
Definition: element_traits.hpp:57
Main namespace of the Reactions package.
Definition: all.hpp:22
static nubase_database & instance()
Get the only instance of this class.
Definition: nubase.hpp.in:407
typename properties< T >::type element_t
Actual C++ type for the given kind of element.
Definition: element_traits.hpp:47
An element based on the NuBase database.
Definition: nubase.hpp.in:166
Handle the properties of elements.
Definition: element_traits.hpp:19
decltype(builder< T >) builder_t
Default builder type for a given kind of element.
Definition: element_traits.hpp:53