Reaktoro
A unified framework for modeling chemically reactive systems
Interpreter.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright (C) 2014-2018 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:
40  Interpreter();
41 
43  Interpreter(const Interpreter& other);
44 
46  virtual ~Interpreter();
47 
49  auto operator=(Interpreter other) -> Interpreter&;
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
auto system() -> const ChemicalSystem &
Return the constructed chemical system.
Definition: Interpreter.cpp:121
Interpreter()
Construct a default Interpreter instance.
Definition: Interpreter.cpp:84
auto executeJsonString(std::string input) -> void
Execute an input script.
Definition: Interpreter.cpp:106
A class to represent a system and its attributes and properties.
Definition: ChemicalSystem.hpp:38
Provides a computational representation of the state of a multiphase chemical system.
Definition: ChemicalState.hpp:61
auto executeJsonFile(std::string input) -> void
Execute an input script.
Definition: Interpreter.cpp:113
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto operator=(Interpreter other) -> Interpreter &
Assing another Interpreter instance to this.
Definition: Interpreter.cpp:95
auto states() -> const std::map< std::string, ChemicalState > &
Return all saved chemical states during the execution.
Definition: Interpreter.cpp:126
Used to interpret json files containing defined calculations.
Definition: Interpreter.hpp:37
virtual ~Interpreter()
Destroy this Interpreter instance.
Definition: Interpreter.cpp:92
auto executeJsonObject(json input) -> void
Execute an input script.
Definition: Interpreter.cpp:101
auto state(std::string reference) -> const ChemicalState &
Return the saved chemical state with given reference name.
Definition: Interpreter.cpp:131