Dune::Copasi
Loading...
Searching...
No Matches
parser.hh
Go to the documentation of this file.
1#ifndef DUNE_COPASI_PARSER_PARSER_HH
2#define DUNE_COPASI_PARSER_PARSER_HH
3
4#include <dune-copasi-config.hh>
5
6#include <functional>
7#include <string>
8#include <unordered_map>
9#include <vector>
10
11#include <function2/function2.hpp>
12
13namespace Dune::Copasi {
14
15class Parser
16{
17
18public:
19 Parser() = default;
20
21 Parser(const Parser&) = delete;
22 Parser(Parser&&) = default;
23
24 Parser& operator=(const Parser&) = delete;
25 Parser& operator=(Parser&&) = default;
26
27 virtual ~Parser() = default;
28
30
31 using Function0D = fu2::unique_function<RangeField() const>;
32 using Function1D = fu2::unique_function<RangeField(RangeField) const>;
36
38
39 [[nodiscard]] std::string expression() const;
40
41 virtual void define_variable(const std::string& symbol, RangeField const* value);
42
43 virtual void define_constant(const std::string& symbol, const RangeField& value) = 0;
44
50
52
53 virtual void compile() = 0;
54
56
59 std::string _expression;
60 std::vector<std::string> _symbols;
62};
63
64} // namespace Dune::Copasi
65
66#endif // DUNE_COPASI_PARSER_PARSER_HH
Definition parser.hh:16
virtual void define_variable(const std::string &symbol, RangeField const *value)
bool compiled() const
std::string expression() const
Parser & operator=(const Parser &)=delete
std::vector< RangeField const * > _variables
Definition parser.hh:61
Parser & operator=(Parser &&)=default
bool _compiled
Definition parser.hh:58
fu2::unique_function< RangeField(RangeField, RangeField, RangeField) const > Function3D
Definition parser.hh:34
fu2::unique_function< RangeField() const > Function0D
Definition parser.hh:31
Parser(Parser &&)=default
fu2::unique_function< RangeField(RangeField, RangeField, RangeField, RangeField) const > Function4D
Definition parser.hh:35
std::string _expression
Definition parser.hh:59
Parser(const Parser &)=delete
virtual void define_function(const std::string &symbol, Function0D &&function)=0
virtual ~Parser()=default
virtual void compile()=0
double RangeField
Definition parser.hh:29
fu2::unique_function< RangeField(RangeField, RangeField) const > Function2D
Definition parser.hh:33
virtual void define_constant(const std::string &symbol, const RangeField &value)=0
fu2::unique_function< RangeField(RangeField) const > Function1D
Definition parser.hh:32
std::vector< std::string > _symbols
Definition parser.hh:60
virtual void set_expression(const std::string &expression)
Definition axis_names.hh:7
constexpr bool is_bitflags_v
Alias for Bitflag indicator.
Definition bit_flags.hh:24