ModuleMath.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef MDD_MODULEMATH_H
  2. #define MDD_MODULEMATH_H
  3. #include "ModuleBase.h"
  4. namespace mdd {
  5. enum MathOperation {
  6. ADD = 1,
  7. SUBTRACT = 2,
  8. MULTIPLY = 3,
  9. DIVIDE = 4,
  10. POWER = 5,
  11. LOGARITHM = 6,
  12. MINIMUM = 7,
  13. MAXIMUM = 8,
  14. LESS_THAN = 9,
  15. GREATER_THAN = 10
  16. };
  17. class ModuleMath : public ModuleBase {
  18. private:
  19. MathOperation _operation;
  20. static json add(const json &val1, const json &val2);
  21. static json subtract(const json &val1, const json &val2);
  22. static json multiply(const json &val1, const json &val2);
  23. static json divide(const json &val1, const json &val2);
  24. static json power(const json &val1, const json &val2);
  25. static json logarithm(const json &val1, const json &val2);
  26. static json minimum(const json &val1, const json &val2);
  27. static json maximum(const json &val1, const json &val2);
  28. static json less(const json &val1, const json &val2);
  29. static json greater(const json &val1, const json &val2);
  30. public:
  31. explicit ModuleMath(MathOperation operation = ADD);
  32. bool update() override;
  33. void setMathOperation(MathOperation operation);
  34. MathOperation getMathOperation();
  35. };
  36. }
  37. #endif