1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #ifndef MDD_MODULEMATH_H
- #define MDD_MODULEMATH_H
- #include "ModuleBase.h"
- namespace mdd {
- enum class MathOperation : char {
- ADD = 1,
- SUBTRACT = 2,
- MULTIPLY = 3,
- DIVIDE = 4,
- POWER = 5,
- LOGARITHM = 6,
- MINIMUM = 7,
- MAXIMUM = 8,
- LESS_THAN = 9,
- GREATER_THAN = 10
- };
- class ModuleMath : public ModuleBase {
- private:
- MathOperation _operation;
- static json add(const json &val1, const json &val2);
- static json subtract(const json &val1, const json &val2);
- static json multiply(const json &val1, const json &val2);
- static json divide(const json &val1, const json &val2);
- static json power(const json &val1, const json &val2);
- static json logarithm(const json &val1, const json &val2);
- static json minimum(const json &val1, const json &val2);
- static json maximum(const json &val1, const json &val2);
- static json less(const json &val1, const json &val2);
- static json greater(const json &val1, const json &val2);
- public:
- explicit ModuleMath(MathOperation operation = MathOperation::ADD);
- state update() override;
- void setMathOperation(MathOperation operation);
- MathOperation getMathOperation();
- };
- }
- #endif
|