SXEval 1.0.3
A generic s-expression interpreter library.
Loading...
Searching...
No Matches
RadiansToDegrees.hpp
Go to the documentation of this file.
1#ifndef SXEVAL_OPERATIONS_RADIANSTODEGREES_HPP
2#define SXEVAL_OPERATIONS_RADIANSTODEGREES_HPP
3
5
6
7/* DEFINITIONS */
8
9namespace sxeval {
10namespace operations {
11
12template <typename T>
13class RadiansToDegrees : public AOperation<T> {
14public:
15 static constexpr const char* KEY = "rad2deg";
16 static constexpr const int ARITY_MIN = 1;
17 static constexpr const int ARITY_MAX = 1;
18
19 inline RadiansToDegrees(const std::vector<IInstruction<T>*>& args) :
20 AOperation<T>(args) {}
21
22 void execute() override;
23
24 inline std::string toString() const override { return KEY; }
25
26};
27
28} /* namespace operations */
29} /* namespace sxeval */
30
31
32/* IMPLEMENTATIONS */
33
34template <typename T>
36
37template <typename T>
39 this->_result = this->_args.front().get() *
40 static_cast<T>(180.0 / SXEVAL_PI);
41}
42
43#endif /* SXEVAL_OPERATIONS_RADIANSTODEGREES_HPP */
The AOperation class is an abstract base class for operations in the SXEval library.
Definition AOperation.hpp:22
The IInstruction class is an interface for any instructions.
Definition IInstruction.hpp:21
Definition RadiansToDegrees.hpp:13
static constexpr const int ARITY_MIN
Definition RadiansToDegrees.hpp:16
RadiansToDegrees(const std::vector< IInstruction< T > * > &args)
Definition RadiansToDegrees.hpp:19
static constexpr const int ARITY_MAX
Definition RadiansToDegrees.hpp:17
std::string toString() const override
String representation of the instruction.
Definition RadiansToDegrees.hpp:24
void execute() override
Execute the operation.
Definition RadiansToDegrees.hpp:38
static constexpr const char * KEY
Definition RadiansToDegrees.hpp:15
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
#define SXEVAL_PI
Definition utils.hpp:10