SXEval 1.0.3
A generic s-expression interpreter library.
Loading...
Searching...
No Matches
Variable.hpp
Go to the documentation of this file.
1#ifndef SXEVAL_VARIABLE_HPP
2#define SXEVAL_VARIABLE_HPP
3
4#include "sxeval/IOperand.hpp"
5
6namespace sxeval {
7
15template <typename T>
16class Variable : public virtual IOperand<T> {
17public:
25 inline Variable(T& var, const std::string& name) : _var(var), _name(name) {}
26
32 inline T& getResult() override { return _var; }
33
39 inline std::string toString() const override { return _name; }
40
41private:
42 T& _var;
43 const std::string _name;
44
45};
46
47} /* namespace sxeval */
48#endif /* SXEVAL_VARIABLE_HPP */
The IOperand class is an interface for operands.
Definition IOperand.hpp:16
The Variable class represents a variable in the SXEval library.
Definition Variable.hpp:16
std::string toString() const override
String representation of the variable.
Definition Variable.hpp:39
T & getResult() override
Get a reference to the variable.
Definition Variable.hpp:32
Variable(T &var, const std::string &name)
Default constructor.
Definition Variable.hpp:25
Definition AOperation.hpp:8
std::enable_if< std::is_unsigned< T >::value, T >::type Absolute(const T &a)
Perform an absolute value operation on types T.
Definition utils.hpp:262