Vita
src/interpreter.h
Go to the documentation of this file.
1
13#if !defined(VITA_SRC_INTERPRETER_H)
14#define VITA_SRC_INTERPRETER_H
15
17
18namespace vita
19{
23using number = D_DOUBLE;
24
31template<class T>
33{
34public:
35 explicit src_interpreter(const T *prg) : interpreter<T>(prg),
36 example_(nullptr)
37 {}
38
39 value_t run(const std::vector<value_t> &);
40
41 [[nodiscard]] value_t fetch_var(unsigned) final;
42
43private:
44 // Tells the compiler we want both the run function from interpreter and
45 // src_interpreter.
46 // Without this statement there will be no `run()` function in the scope
47 // of src_interpreter, because it is hidden by another method with the same
48 // name (compiler won't search for function in base classes if derived
49 // class has at least one method with specified name, even if it has
50 // different arguments).
52
53 const std::vector<value_t> *example_;
54};
55
56template<class T> value_t run(const T &, const std::vector<value_t> &);
57
58#include "kernel/gp/src/interpreter.tcc"
59
60} // namespace vita
61
62#endif // include guard
The main namespace for the project.
D_DOUBLE number
This is the return type of the src_interpreter::run method.
value_t run(const T &ind)
A handy short-cut for one-time execution of an individual.
std::variant< D_VOID, D_INT, D_DOUBLE, D_STRING > value_t
A variant containing the data types used by the interpreter for internal calculations / output value ...
Definition: value.h:45