1#ifndef OASIS_EXPRESSION_HPP
2#define OASIS_EXPRESSION_HPP
12class SerializationVisitor;
95 [[nodiscard]] virtual auto
GetCategory() const -> uint32_t;
136 [[nodiscard]]
bool Is()
const
138 return GetType() == T::GetStaticType();
141 template <
template <
typename>
typename T>
143 [[nodiscard]]
bool Is()
const
145 return GetType() == T<Expression>::GetStaticType();
148 template <
template <
typename,
typename>
typename T>
150 [[nodiscard]]
bool Is()
const
152 return GetType() == T<Expression, Expression>::GetStaticType();
185#define EXPRESSION_TYPE(type) \
186 auto GetType() const -> ExpressionType override \
188 return ExpressionType::type; \
191 static auto GetStaticType() -> ExpressionType \
193 return ExpressionType::type; \
196#define EXPRESSION_CATEGORY(category) \
197 auto GetCategory() const -> uint32_t override \
202 constexpr static auto GetStaticCategory() -> uint32_t \
207#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:57
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:136
bool Is() const
Definition Expression.hpp:143
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:150
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
Definition Concepts.hpp:51
Definition Concepts.hpp:56
An expression concept.
Definition Concepts.hpp:25
ExpressionCategory
The category of an expression.
Definition Expression.hpp:42
@ UnExp
Definition Expression.hpp:47
@ None
Definition Expression.hpp:43
@ Commutative
Definition Expression.hpp:45
@ Associative
Definition Expression.hpp:44
@ BinExp
Definition Expression.hpp:46
ExpressionType
The type of an expression.
Definition Expression.hpp:17