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.
102 lines
4.1 KiB
102 lines
4.1 KiB
#ifndef STORM_STORAGE_PRISM_CONSTANT_H_
|
|
#define STORM_STORAGE_PRISM_CONSTANT_H_
|
|
|
|
#include <map>
|
|
|
|
#include "src/storage/prism/LocatedInformation.h"
|
|
#include "src/storage/expressions/Expression.h"
|
|
#include "src/storage/expressions/Variable.h"
|
|
#include "src/utility/OsDetection.h"
|
|
|
|
namespace storm {
|
|
namespace prism {
|
|
class Constant : public LocatedInformation {
|
|
public:
|
|
/*!
|
|
* Creates a defined constant.
|
|
*
|
|
* @param variable The expression variable associated with the constant.
|
|
* @param expression The expression that defines the constant.
|
|
* @param filename The filename in which the transition reward is defined.
|
|
* @param lineNumber The line number in which the transition reward is defined.
|
|
*/
|
|
Constant(storm::expressions::Variable const& variable, storm::expressions::Expression const& expression, std::string const& filename = "", uint_fast64_t lineNumber = 0);
|
|
|
|
/*!
|
|
* Creates an undefined constant.
|
|
*
|
|
* @param variable The expression variable associated with the constant.
|
|
* @param filename The filename in which the transition reward is defined.
|
|
* @param lineNumber The line number in which the transition reward is defined.
|
|
*/
|
|
Constant(storm::expressions::Variable const& variable, std::string const& filename = "", uint_fast64_t lineNumber = 0);
|
|
|
|
// Create default implementations of constructors/assignment.
|
|
Constant() = default;
|
|
Constant(Constant const& other) = default;
|
|
Constant& operator=(Constant const& other)= default;
|
|
#ifndef WINDOWS
|
|
Constant(Constant&& other) = default;
|
|
Constant& operator=(Constant&& other) = default;
|
|
#endif
|
|
|
|
/*!
|
|
* Retrieves the name of the constant.
|
|
*
|
|
* @return The name of the constant.
|
|
*/
|
|
std::string const& getName() const;
|
|
|
|
/*!
|
|
* Retrieves the type of the constant.
|
|
*
|
|
* @return The type of the constant;
|
|
*/
|
|
storm::expressions::Type const& getType() const;
|
|
|
|
/*!
|
|
* Retrieves the expression variable associated with this constant.
|
|
*
|
|
* @return The expression variable associated with this constant.
|
|
*/
|
|
storm::expressions::Variable const& getExpressionVariable() const;
|
|
|
|
/*!
|
|
* Retrieves whether the constant is defined, i.e., whether there is an expression defining its value.
|
|
*
|
|
* @return True iff the constant is defined.
|
|
*/
|
|
bool isDefined() const;
|
|
|
|
/*!
|
|
* Retrieves the expression that defines the constant. This may only be called if the object is a defined
|
|
* constant.
|
|
*
|
|
* @return The expression that defines the constant.
|
|
*/
|
|
storm::expressions::Expression const& getExpression() const;
|
|
|
|
/*!
|
|
* Substitutes all identifiers in the constant according to the given map.
|
|
*
|
|
* @param substitution The substitution to perform.
|
|
* @return The resulting constant.
|
|
*/
|
|
Constant substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution) const;
|
|
|
|
friend std::ostream& operator<<(std::ostream& stream, Constant const& constant);
|
|
|
|
private:
|
|
// The expression variable associated with the constant.
|
|
storm::expressions::Variable variable;
|
|
|
|
// A flag that stores whether or not the constant is defined.
|
|
bool defined;
|
|
|
|
// The expression that defines the constant (in case it is defined).
|
|
storm::expressions::Expression expression;
|
|
};
|
|
} // namespace prism
|
|
} // namespace storm
|
|
|
|
#endif /* STORM_STORAGE_PRISM_CONSTANT_H_ */
|