SXEval 1.0.3
A generic s-expression interpreter library.
Loading...
Searching...
No Matches
IInstruction.hpp
Go to the documentation of this file.
1#ifndef SXEVAL_IINSTRUCTION_HPP
2#define SXEVAL_IINSTRUCTION_HPP
3
4#include <string>
5
6
7/* DEFINITIONS */
8
9namespace sxeval {
10
20template <typename T>
22public:
26 virtual ~IInstruction() = default;
27
33 virtual T& getResult() = 0;
34
40 virtual std::string toString() const = 0;
41
42};
43
50template <typename T>
51inline std::ostream& operator<<(std::ostream& os, const IInstruction<T>& obj) {
52 return os << obj.toString();
53}
54
55} /* namespace sxeval */
56#endif /* SXEVAL_IINSTRUCTION_HPP */
The IInstruction class is an interface for any instructions.
Definition IInstruction.hpp:21
virtual T & getResult()=0
Get a reference to the result of the instruction.
virtual ~IInstruction()=default
Default destructor.
virtual std::string toString() const =0
String representation of the instruction.
Definition AOperation.hpp:8
std::ostream & operator<<(std::ostream &os, const IInstruction< T > &obj)
Output stream operator for AInstruction.
Definition IInstruction.hpp:51