summaryrefslogtreecommitdiff
path: root/src/helpers/math/Expression.hpp
blob: 1780e3eeb1d68c996d16e750aaafb41a48d52be8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include "../memory/Memory.hpp"
#include <string>
#include <optional>

namespace mu {
    class Parser;
};

namespace Math {
    class CExpression {
      public:
        CExpression();
        ~CExpression() = default;

        CExpression(const CExpression&) = delete;
        CExpression(CExpression&)       = delete;
        CExpression(CExpression&&)      = delete;

        void                  addVariable(const std::string& name, double val);

        std::optional<double> compute(const std::string& expr);

      private:
        UP<mu::Parser> m_parser;
    };
};