ModuleMath.h 746 B

1234567891011121314151617181920212223242526272829303132
  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. };
  11. class ModuleMath : public ModuleBase {
  12. private:
  13. MathOperation _operation;
  14. json add(const json &val1, const json &val2);
  15. json subtract(const json &val1, const json &val2);
  16. json multiply(const json &val1, const json &val2);
  17. json divide(const json &val1, const json &val2);
  18. public:
  19. explicit ModuleMath(MathOperation operation = ADD);
  20. void update() override;
  21. void setMathOperation(MathOperation operation);
  22. MathOperation getMathOperation();
  23. };
  24. }
  25. #endif