Reaktoro  v2.9.4
A unified framework for modeling chemically reactive systems
Interpreter.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright © 2014-2022 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 // C++ includes
21 #include <map>
22 #include <memory>
23 #include <string>
24 #include <fstream>
25 
26 // Reaktoro includes
27 #include <Reaktoro/Common/Json.hpp>
28 
29 namespace Reaktoro {
30 
31 // Forward declarations
32 class ChemicalState;
33 class ChemicalSystem;
34 
37 {
38 public:
41 
43  Interpreter(const Interpreter& other);
44 
46  virtual ~Interpreter();
47 
50 
53  auto executeJsonObject(json input) -> void;
54 
57  auto executeJsonString(std::string input) -> void;
58 
61  auto executeJsonFile(std::string input) -> void;
62 
64  auto system() -> const ChemicalSystem&;
65 
67  auto states() -> const std::map<std::string, ChemicalState>&;
68 
70  auto state(std::string reference) -> const ChemicalState&;
71 
72 private:
73  struct Impl;
74 
75  std::unique_ptr<Impl> pimpl;
76 };
77 
78 } // namespace Reaktoro
The chemical state of a chemical system.
Definition: ChemicalState.hpp:41
The class used to represent a chemical system and its attributes and properties.
Definition: ChemicalSystem.hpp:70
Used to interpret json files containing defined calculations.
Definition: Interpreter.hpp:37
auto states() -> const std::map< std::string, ChemicalState > &
Return all saved chemical states during the execution.
auto operator=(Interpreter other) -> Interpreter &
Assing another Interpreter instance to this.
virtual ~Interpreter()
Destroy this Interpreter instance.
Interpreter()
Construct a default Interpreter instance.
auto executeJsonFile(std::string input) -> void
Execute an input script.
auto system() -> const ChemicalSystem &
Return the constructed chemical system.
auto executeJsonObject(json input) -> void
Execute an input script.
Interpreter(const Interpreter &other)
Construct a copy of an Interpreter instance.
auto state(std::string reference) -> const ChemicalState &
Return the saved chemical state with given reference name.
auto executeJsonString(std::string input) -> void
Execute an input script.
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29