1
0

IterationFormula.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef MANDEL_ITERATIONFORMULA_H
  2. #define MANDEL_ITERATIONFORMULA_H
  3. #include <variant>
  4. #include <memory>
  5. namespace mnd
  6. {
  7. struct IterationFormula;
  8. struct Constant;
  9. struct Variable;
  10. struct UnaryOperation;
  11. struct BinaryOperation;
  12. struct Addition;
  13. struct Multiplication;
  14. struct Division;
  15. struct Pow;
  16. using Expression = std::variant<
  17. Constant,
  18. Variable,
  19. UnaryOperation,
  20. Addition,
  21. Multiplication,
  22. Division,
  23. Pow
  24. >;
  25. class FormulaVisitor;
  26. }
  27. struct mnd::IterationFormula
  28. {
  29. std::unique_ptr<Expression> expr;
  30. };
  31. struct mnd::Constant
  32. {
  33. double value;
  34. };
  35. struct mnd::Variable
  36. {
  37. std::string name;
  38. };
  39. struct mnd::UnaryOperation
  40. {
  41. std::unique_ptr<Expression> operand;
  42. };
  43. struct mnd::BinaryOperation
  44. {
  45. std::unique_ptr<Expression> left;
  46. std::unique_ptr<Expression> right;
  47. };
  48. struct mnd::Addition : mnd::BinaryOperation
  49. {
  50. bool subtraction = false;
  51. };
  52. struct mnd::Multiplication : mnd::BinaryOperation
  53. {
  54. };
  55. struct mnd::Division : mnd::BinaryOperation
  56. {
  57. };
  58. struct mnd::Pow : mnd::BinaryOperation
  59. {
  60. };
  61. #endif // MANDEL_ITERATIONFORMULA_H