Ultra 0.9.4
Loading...
Searching...
No Matches
src/interpreter.h
Go to the documentation of this file.
1
12
13#if !defined(ULTRA_SRC_INTERPRETER_H)
14#define ULTRA_SRC_INTERPRETER_H
15
17
18namespace ultra::src
19{
26{
27public:
28 explicit interpreter(const gp::individual &);
29
30 value_t run(const std::vector<value_t> &);
31
32 [[nodiscard]] value_t fetch_var(std::size_t) const;
33
34private:
35 // Tells the compiler we want both the run function from `ultra::interpreter`
36 // and `ultra::src::interpreter`.
37 // Without this statement there will be no `run()` function in the scope
38 // of `src::interpreter`, because it would be hidden by another method with
39 // the same name (compiler won't search for function in base classes if
40 // derived class has at least one method with specified name, even if it has
41 // different arguments).
43
44 const std::vector<value_t> *example_ {nullptr};
45};
46
47[[nodiscard]] value_t run(const gp::individual &,
48 const std::vector<value_t> &);
49
50} // namespace ultra
51
52#endif // include guard
Definition gp/individual.h:66
Definition interpreter.h:60
value_t run()
Definition interpreter.cc:107
value_t run(const locus &)
Definition interpreter.cc:83
value_t fetch_var(std::size_t) const
Definition src/interpreter.cc:46
interpreter(const gp::individual &)
Definition src/interpreter.cc:24
std::variant< D_VOID, D_INT, D_DOUBLE, D_STRING, const D_NULLARY *, D_ADDRESS, const D_VARIABLE *, D_IVECTOR > value_t
Definition value.h:54
value_t run(const gp::individual &ind, const std::vector< value_t > &ex)
Definition src/interpreter.cc:60