Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
PhreeqcDatabase.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright © 2014-2024 Allan Leal
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // Reaktoro includes
21 #include <Reaktoro/Core/Database.hpp>
22 
23 // Forward declaration of PHREEQC class
24 class PHREEQC;
25 
26 namespace Reaktoro {
27 
29 class PhreeqcDatabase : public Database
30 {
31 public:
34 
48  PhreeqcDatabase(const String& name);
49 
54  auto load(const String& database) -> PhreeqcDatabase&;
55 
57  auto ptr() const -> SharedPtr<PHREEQC> const&;
58 
72  static auto withName(const String& name) -> PhreeqcDatabase;
73 
77  static auto fromFile(const String& path) -> PhreeqcDatabase;
78 
81  static auto fromContents(const String& contents) -> PhreeqcDatabase;
82 
86  static auto contents(const String& name) -> String;
87 
89  static auto namesEmbeddedDatabases() -> Strings;
90 
91 private:
93  SharedPtr<PHREEQC> m_ptr;
94 };
95 
96 } // namespace Reaktoro
The class used to store and retrieve data of chemical species.
Definition: Database.hpp:32
The class used to store and retrieve data of chemical species from PHREEQC databases.
Definition: PhreeqcDatabase.hpp:30
auto load(const String &database) -> PhreeqcDatabase &
Extend this PhreeqcDatabase object with contents in given database file.
static auto contents(const String &name) -> String
Return the contents of an embedded PHREEQC database as a string.
PhreeqcDatabase()
Construct a default PhreeqcDatabase object.
static auto fromContents(const String &contents) -> PhreeqcDatabase
Return a PhreeqcDatabase object constructed with given database text contents.
auto ptr() const -> SharedPtr< PHREEQC > const &
Return the underlying PHREEQC object.
static auto withName(const String &name) -> PhreeqcDatabase
Return a PhreeqcDatabase object constructed with an embedded database file.
static auto fromFile(const String &path) -> PhreeqcDatabase
Return a PhreeqcDatabase object constructed with a given local file.
static auto namesEmbeddedDatabases() -> Strings
Return the names of the currently supported embedded PHREEQC databases.
PhreeqcDatabase(const String &name)
Construct a PhreeqcDatabase object using an embedded PHREEQC database.
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
std::string String
Convenient alias for std::string.
Definition: Types.hpp:52
std::vector< std::string > Strings
Convenient alias for std::vector<String>.
Definition: Types.hpp:55
std::shared_ptr< T > SharedPtr
Convenient alias for std::shared_ptr<T>.
Definition: Types.hpp:106