Reactions  0.1.1
Handling reaction trees and decays
Public Types | Public Member Functions | Static Public Member Functions | List of all members
reactions::nubase_database Class Referencefinal

Database of elements with the NuBase information. More...

Inheritance diagram for reactions::nubase_database:
Inheritance graph
[legend]
Collaboration diagram for reactions::nubase_database:
Collaboration graph
[legend]

Public Types

using base_type = reactions::database::database< nubase_element, nubase::name, nubase::nubase_id >
 
- Public Types inherited from reactions::database::database< nubase_element, nubase::name, nubase::nubase_id >
using element_type = nubase_element
 

Public Member Functions

std::string const & get_database_path () const
 Get the path to the database file. More...
 
template<class... Args>
void register_element (Args &&... args)
 Register a new NuBase element. More...
 
nubase_element operator() (int id) const override
 Create an element accessing by ID. More...
 
nubase_element operator() (std::string const &str) const override
 Create an element accessing by name. More...
 
- Public Member Functions inherited from reactions::database::database< nubase_element, nubase::name, nubase::nubase_id >
virtual ~database ()
 
std::vector< element_typeall_elements () const
 All the elements in the database file. More...
 
void clear_cache ()
 Clear the cache, removing also user-registered elements. More...
 
void disable_cache ()
 Disable the cache. More...
 
void enable_cache ()
 
std::string const & get_database_path () const
 Get the path to the database file. More...
 
void register_element (Args &&... args)
 Register a new element. More...
 
void set_database_path (std::string const &s)
 

Static Public Member Functions

static nubase_databaseinstance ()
 Get the only instance of this class. More...
 

Additional Inherited Members

- Protected Member Functions inherited from reactions::database::database< nubase_element, nubase::name, nubase::nubase_id >
std::ifstream open_database () const
 Open the database. More...
 
std::streampos skip_commented_lines (std::ifstream &file) const
 Skip lines with comments (preceeded by *) More...
 
bool read_field (typename element_type::base_type &tuple, std::string const &line) const
 Read a field with the given index from a line. More...
 
bool read_line (typename element_type::base_type &tuple, std::string const &line, std::index_sequence< I... >) const
 Read all the fields from a line. More...
 
bool read_line (typename element_type::base_type &tuple, std::string const &line) const
 Read all the fields from a line. More...
 
element_type read_element (std::string const &line) const
 Advance to the next element in the file and read it. More...
 
element_type access (T const &v) const
 Access an element using the field accessor. More...
 
 database (std::string &&db)
 
 database (database &&)=delete
 
 database (database const &)=delete
 
void operator= (database &&)=delete
 
void operator= (database const &)=delete
 
- Protected Attributes inherited from reactions::database::database< nubase_element, nubase::name, nubase::nubase_id >
std::string m_db
 Path to the database file. More...
 
class reactions::database::database::cache m_cache
 

Detailed Description

Database of elements with the NuBase information.

Member Typedef Documentation

◆ base_type

Member Function Documentation

◆ get_database_path()

std::string const& reactions::nubase_database::get_database_path ( ) const
inline

Get the path to the database file.

◆ instance()

static nubase_database& reactions::nubase_database::instance ( )
inlinestatic

Get the only instance of this class.

◆ operator()() [1/2]

nubase_element reactions::nubase_database::operator() ( int  id) const
inlineoverridevirtual

◆ operator()() [2/2]

nubase_element reactions::nubase_database::operator() ( std::string const &  str) const
inlineoverridevirtual

◆ register_element()

template<class... Args>
void reactions::nubase_database::register_element ( Args &&...  args)
inline

Register a new NuBase element.

The new element must have a name and a NuBase ID that does not clash with any of the database used.

For the LaTeX name to be valid (an to avoid possible exceptions thrown during its computation), the element name must follow the following convention:

  • The name starts with the mass number
  • The mass number is followed by the element name
  • A possible isomer state identifier can be added between parentheses.

The documentation for this class was generated from the following file: