1#ifndef OASIS_EXPRESSION_HPP
2#define OASIS_EXPRESSION_HPP
11class SerializationVisitor;
94 [[nodiscard]] virtual auto
GetCategory() const -> uint32_t;
134 [[nodiscard]]
bool Is()
const
136 return GetType() == T::GetStaticType();
139 template <
template <
typename>
typename T>
140 [[nodiscard]]
bool Is()
const
142 return GetType() == T<Expression>::GetStaticType();
145 template <
template <
typename,
typename>
typename T>
146 [[nodiscard]]
bool Is()
const
148 return GetType() == T<Expression, Expression>::GetStaticType();
181#define EXPRESSION_TYPE(type) \
182 auto GetType() const -> ExpressionType override \
184 return ExpressionType::type; \
187 static auto GetStaticType() -> ExpressionType \
189 return ExpressionType::type; \
192#define EXPRESSION_CATEGORY(category) \
193 auto GetCategory() const -> uint32_t override \
198 constexpr static auto GetStaticCategory() -> uint32_t \
203#define DECL_SPECIALIZE(type)
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:56
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 void Serialize(SerializationVisitor &visitor) const =0
This function serializes the expression object.
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:134
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
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.
Definition Magnitude.hpp:28
Definition Serialization.hpp:50
An expression concept.
Definition Concepts.hpp:25
ExpressionCategory
The category of an expression.
Definition Expression.hpp:41
@ UnExp
Definition Expression.hpp:46
@ None
Definition Expression.hpp:42
@ Commutative
Definition Expression.hpp:44
@ Associative
Definition Expression.hpp:43
@ BinExp
Definition Expression.hpp:45
ExpressionType
The type of an expression.
Definition Expression.hpp:16