You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
3.0 KiB
61 lines
3.0 KiB
#ifndef STORM_STORAGE_EXPRESSIONS_BINARYNUMERICALFUNCTIONEXPRESSION_H_
|
|
#define STORM_STORAGE_EXPRESSIONS_BINARYNUMERICALFUNCTIONEXPRESSION_H_
|
|
|
|
#include "src/storage/expressions/BinaryExpression.h"
|
|
#include "src/utility/OsDetection.h"
|
|
|
|
namespace storm {
|
|
namespace expressions {
|
|
class BinaryNumericalFunctionExpression : public BinaryExpression {
|
|
public:
|
|
/*!
|
|
* An enum type specifying the different operators applicable.
|
|
*/
|
|
enum class OperatorType {Plus, Minus, Times, Divide, Min, Max, Power};
|
|
|
|
/*!
|
|
* Constructs a binary numerical function expression with the given return type, operands and operator.
|
|
*
|
|
* @param manager The manager responsible for this expression.
|
|
* @param type The return type of the expression.
|
|
* @param firstOperand The first operand of the expression.
|
|
* @param secondOperand The second operand of the expression.
|
|
* @param functionType The operator of the expression.
|
|
*/
|
|
BinaryNumericalFunctionExpression(ExpressionManager const& manager, Type const& type, std::shared_ptr<BaseExpression const> const& firstOperand, std::shared_ptr<BaseExpression const> const& secondOperand, OperatorType operatorType);
|
|
|
|
// Instantiate constructors and assignments with their default implementations.
|
|
BinaryNumericalFunctionExpression(BinaryNumericalFunctionExpression const& other) = default;
|
|
BinaryNumericalFunctionExpression& operator=(BinaryNumericalFunctionExpression const& other) = delete;
|
|
#ifndef WINDOWS
|
|
BinaryNumericalFunctionExpression(BinaryNumericalFunctionExpression&&) = default;
|
|
BinaryNumericalFunctionExpression& operator=(BinaryNumericalFunctionExpression&&) = delete;
|
|
#endif
|
|
virtual ~BinaryNumericalFunctionExpression() = default;
|
|
|
|
// Override base class methods.
|
|
virtual storm::expressions::OperatorType getOperator() const override;
|
|
virtual int_fast64_t evaluateAsInt(Valuation const* valuation = nullptr) const override;
|
|
virtual double evaluateAsDouble(Valuation const* valuation = nullptr) const override;
|
|
virtual std::shared_ptr<BaseExpression const> simplify() const override;
|
|
virtual boost::any accept(ExpressionVisitor& visitor) const override;
|
|
|
|
/*!
|
|
* Retrieves the operator associated with the expression.
|
|
*
|
|
* @return The operator associated with the expression.
|
|
*/
|
|
OperatorType getOperatorType() const;
|
|
|
|
protected:
|
|
// Override base class method.
|
|
virtual void printToStream(std::ostream& stream) const override;
|
|
|
|
private:
|
|
// The operator of the expression.
|
|
OperatorType operatorType;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif /* STORM_STORAGE_EXPRESSIONS_BINARYNUMERICALFUNCTIONEXPRESSION_H_ */
|