1#ifndef OASIS_EXPRESSION_HPP
2#define OASIS_EXPRESSION_HPP
97 [[nodiscard]] virtual auto
GetCategory() const -> uint32_t;
138 [[nodiscard]]
bool Is()
const
140 return GetType() == T::GetStaticType();
143 template <
template <
typename>
typename T>
145 [[nodiscard]]
bool Is()
const
147 return GetType() == T<Expression>::GetStaticType();
150 template <
template <
typename,
typename>
typename T>
152 [[nodiscard]]
bool Is()
const
154 return GetType() == T<Expression, Expression>::GetStaticType();
178 std::optional<typename T::RetT>
Accept(T& visitor) const;
201#define EXPRESSION_TYPE(type) \
202 auto GetType() const -> ExpressionType override \
204 return ExpressionType::type; \
207 static auto GetStaticType() -> ExpressionType \
209 return ExpressionType::type; \
212#define EXPRESSION_CATEGORY(category) \
213 auto GetCategory() const -> uint32_t override \
218 constexpr static auto GetStaticCategory() -> uint32_t \
std::unique_ptr< Oasis::Expression > operator+(const std::unique_ptr< Oasis::Expression > &lhs, const std::unique_ptr< Oasis::Expression > &rhs)
Definition Expression.cpp:250
std::unique_ptr< Oasis::Expression > operator*(const std::unique_ptr< Oasis::Expression > &lhs, const std::unique_ptr< Oasis::Expression > &rhs)
Definition Expression.cpp:258
std::unique_ptr< Oasis::Expression > operator/(const std::unique_ptr< Oasis::Expression > &lhs, const std::unique_ptr< Oasis::Expression > &rhs)
Definition Expression.cpp:262
std::unique_ptr< Oasis::Expression > operator-(const std::unique_ptr< Oasis::Expression > &lhs, const std::unique_ptr< Oasis::Expression > &rhs)
Definition Expression.cpp:254
An expression.
Definition Expression.hpp:59
virtual auto Copy() const -> std::unique_ptr< Expression >=0
Copies this expression.
virtual auto StructurallyEquivalent(const Expression &other) const -> bool=0
Checks whether this expression is structurally equivalent to another expression.
virtual auto Integrate(const Expression &) const -> std::unique_ptr< Expression >
Attempts to integrate this expression using integration rules.
Definition Expression.cpp:230
virtual auto GetCategory() const -> uint32_t
Gets the category of this expression.
Definition Expression.cpp:212
auto FindZeros() const -> std::vector< std::unique_ptr< Expression > >
The FindZeros function finds all rational real zeros, and up to 2 irrational/complex zeros of a polyn...
Definition Expression.cpp:51
bool Is() const
Gets whether this expression is of a specific type.
Definition Expression.hpp:138
std::optional< typename T::RetT > Accept(T &visitor) const
Definition Expression.hpp:192
bool Is() const
Definition Expression.hpp:145
virtual auto GetType() const -> ExpressionType
Gets the type of this expression.
Definition Expression.cpp:220
virtual auto IntegrateWithBounds(const Expression &, const Expression &, const Expression &) -> std::unique_ptr< Expression >
Attempts to integrate this expression using integration rules.
Definition Expression.cpp:237
virtual auto Simplify() const -> std::unique_ptr< Expression >
Simplifies this expression.
Definition Expression.cpp:244
virtual auto Differentiate(const Expression &) const -> std::unique_ptr< Expression >
Tries to differentiate this function.
Definition Expression.cpp:216
bool Is() const
Definition Expression.hpp:152
virtual auto Substitute(const Expression &var, const Expression &val) -> std::unique_ptr< Expression >=0
virtual auto Generalize() const -> std::unique_ptr< Expression >
Converts this expression to a more general expression.
Definition Expression.cpp:225
virtual auto Equals(const Expression &other) const -> bool=0
Compares this expression to another expression for equality.
virtual std::any AcceptInternal(Visitor &visitor) const =0
This function serializes the expression object.
Definition Magnitude.hpp:28
Definition Concepts.hpp:53
Definition Concepts.hpp:58
An expression concept.
Definition Concepts.hpp:27
Definition Concepts.hpp:63
ExpressionCategory
The category of an expression.
Definition Expression.hpp:44
@ UnExp
Definition Expression.hpp:49
@ None
Definition Expression.hpp:45
@ Commutative
Definition Expression.hpp:47
@ Associative
Definition Expression.hpp:46
@ BinExp
Definition Expression.hpp:48
ExpressionType
The type of an expression.
Definition Expression.hpp:19