Reaktoro  v2.0.0
A unified framework for modeling chemically reactive systems

The class used to store and retrieve data of chemical species. More...

#include <Database.hpp>

Public Member Functions

 Database ()
 Construct a default Database object.
 
 Database (const Database &other)
 Construct a copy of a Database object.
 
 Database (const Vec< Element > &elements, const Vec< Species > &species)
 Construct a Database object with given elements and species.
 
 Database (const Vec< Species > &species)
 Construct a Database object with given species (elements extracted from them).
 
 ~Database ()
 Destroy this Database object.
 
auto operator= (Database other) -> Database &
 Assign another Database object to this.
 
auto clear () -> void
 Remove all species and elements from the database.
 
auto addElement (const Element &element) -> void
 Add an element in the database. More...
 
auto addSpecies (const Species &species) -> void
 Add a species in the database. More...
 
auto addSpecies (const Vec< Species > &species) -> void
 Add a list of species in the database.
 
auto attachData (const Any &data) -> void
 Attach data to this database whose type is known at runtime only.
 
auto extend (const Database &other) -> void
 Extend this database with the elements, species and other contents from another database.
 
auto elements () const -> const ElementList &
 Return all elements in the database.
 
auto species () const -> const SpeciesList &
 Return all species in the database.
 
auto speciesWithAggregateState (AggregateState option) const -> SpeciesList
 Return all species in the database with given aggregate state.
 
auto element (const String &symbol) const -> const Element &
 Return an element with given symbol in the database. More...
 
auto species (const String &name) const -> const Species &
 Return a species with given name in the database. More...
 
auto reaction (const String &equation) const -> Reaction
 Construct a reaction with given equation. More...
 
auto attachedData () const -> const Any &
 Return the attached data to this database whose type is known at runtime only.
 

Static Public Member Functions

static auto fromFile (const String &path) -> Database
 Return a Database object constructed with a given local file. More...
 
static auto fromContents (const String &contents) -> Database
 Return a Database object constructed with given database text contents. More...
 
static auto fromStream (std::istream &stream) -> Database
 Return a Database object constructed with given input stream containing the database text contents. More...
 

Detailed Description

The class used to store and retrieve data of chemical species.

See also
Element, Species

Member Function Documentation

◆ fromFile()

static auto fromFile ( const String path) -> Database
static

Return a Database object constructed with a given local file.

Warning
An exception is thrown if path does not point to a valid database file.
Parameters
pathThe path, including file name, to the database file.

◆ fromContents()

static auto fromContents ( const String contents) -> Database
static

Return a Database object constructed with given database text contents.

Parameters
contentsThe contents of the database as a string.

◆ fromStream()

static auto fromStream ( std::istream &  stream) -> Database
static

Return a Database object constructed with given input stream containing the database text contents.

Parameters
streamThe input stream containing the database file contents.

◆ addElement()

auto addElement ( const Element element) -> void

Add an element in the database.

Note
If an Element object with same symbol already exists in the Database container, the given Element object is not added.

◆ addSpecies()

auto addSpecies ( const Species species) -> void

Add a species in the database.

Note
If a Species object with same name already exists in the Database container, the added Species object has its name slightly changed (e.g. H2O becomes H2O!).

◆ element()

auto element ( const String symbol) const -> const Element &

Return an element with given symbol in the database.

Warning
An exception is thrown if no element with given symbol exists.

◆ species()

auto species ( const String name) const -> const Species &

Return a species with given name in the database.

Warning
An exception is thrown if no species with given name exists.

◆ reaction()

auto reaction ( const String equation) const -> Reaction

Construct a reaction with given equation.

Warning
An exception is thrown if the reaction has an inexistent species in the database.

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