26 changed files with 585 additions and 61 deletions
-
69src/storm-parsers/parser/PrismParser.cpp
-
47src/storm-parsers/parser/PrismParser.h
-
19src/storm/storage/jani/ArrayEliminator.cpp
-
9src/storm/storage/jani/Automaton.cpp
-
5src/storm/storage/jani/Automaton.h
-
32src/storm/storage/jani/ClockVariable.cpp
-
32src/storm/storage/jani/ClockVariable.h
-
29src/storm/storage/jani/FunctionEliminator.cpp
-
23src/storm/storage/jani/JSONExporter.cpp
-
16src/storm/storage/jani/Location.cpp
-
19src/storm/storage/jani/Location.h
-
12src/storm/storage/jani/Model.cpp
-
5src/storm/storage/jani/Model.h
-
13src/storm/storage/jani/Variable.cpp
-
4src/storm/storage/jani/Variable.h
-
36src/storm/storage/jani/VariableSet.cpp
-
26src/storm/storage/jani/VariableSet.h
-
24src/storm/storage/jani/traverser/JaniTraverser.cpp
-
2src/storm/storage/jani/traverser/JaniTraverser.h
-
24src/storm/storage/prism/ClockVariable.cpp
-
37src/storm/storage/prism/ClockVariable.h
-
44src/storm/storage/prism/Module.cpp
-
52src/storm/storage/prism/Module.h
-
46src/storm/storage/prism/Program.cpp
-
2src/storm/storage/prism/Program.h
-
19src/storm/storage/prism/ToJaniConverter.cpp
@ -0,0 +1,32 @@ |
|||||
|
#include "storm/storage/jani/ClockVariable.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace jani { |
||||
|
|
||||
|
ClockVariable::ClockVariable(std::string const& name, storm::expressions::Variable const& variable) : Variable(name, variable) { |
||||
|
// Intentionally left empty.
|
||||
|
} |
||||
|
|
||||
|
ClockVariable::ClockVariable(std::string const& name, storm::expressions::Variable const& variable, storm::expressions::Expression const& initValue, bool transient) : Variable(name, variable, initValue, transient) { |
||||
|
// Intentionally left empty.
|
||||
|
} |
||||
|
|
||||
|
std::unique_ptr<Variable> ClockVariable::clone() const { |
||||
|
return std::make_unique<ClockVariable>(*this); |
||||
|
} |
||||
|
|
||||
|
bool ClockVariable::isClockVariable() const { |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
std::shared_ptr<ClockVariable> makeClockVariable(std::string const& name, storm::expressions::Variable const& variable, boost::optional<storm::expressions::Expression> initValue, bool transient) { |
||||
|
if (initValue) { |
||||
|
return std::make_shared<ClockVariable>(name, variable, initValue.get(), transient); |
||||
|
} else { |
||||
|
assert(!transient); |
||||
|
return std::make_shared<ClockVariable>(name, variable); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include "storm/storage/jani/Variable.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace jani { |
||||
|
|
||||
|
class ClockVariable : public Variable { |
||||
|
public: |
||||
|
|
||||
|
/*! |
||||
|
* Creates a clock variable |
||||
|
*/ |
||||
|
ClockVariable(std::string const& name, storm::expressions::Variable const& variable); |
||||
|
|
||||
|
/*! |
||||
|
* Creates a clock variable with initial value |
||||
|
*/ |
||||
|
ClockVariable(std::string const& name, storm::expressions::Variable const& variable, storm::expressions::Expression const& initialValue, bool transient=false); |
||||
|
|
||||
|
virtual std::unique_ptr<Variable> clone() const override; |
||||
|
|
||||
|
virtual bool isClockVariable() const override; |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Convenience function to call the appropriate constructor and return a shared pointer to the variable. |
||||
|
*/ |
||||
|
std::shared_ptr<ClockVariable> makeClockVariable(std::string const& name, storm::expressions::Variable const& variable, boost::optional<storm::expressions::Expression> initValue, bool transient); |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
#include "storm/storage/prism/ClockVariable.h"
|
||||
|
|
||||
|
#include "storm/storage/expressions/ExpressionManager.h"
|
||||
|
#include "storm/utility/constants.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace prism { |
||||
|
ClockVariable::ClockVariable(storm::expressions::Variable const& variable, bool observable, std::string const& filename, uint_fast64_t lineNumber) : Variable(variable, variable.getManager().rational(storm::utility::zero<storm::RationalNumber>()), observable, filename, lineNumber) { |
||||
|
// Nothing to do here.
|
||||
|
} |
||||
|
|
||||
|
void ClockVariable::createMissingInitialValue() { |
||||
|
if (!this->hasInitialValue()) { |
||||
|
this->setInitialValueExpression(this->getExpressionVariable().getManager().rational(storm::utility::zero<storm::RationalNumber>())); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
std::ostream& operator<<(std::ostream& stream, ClockVariable const& variable) { |
||||
|
stream << variable.getName() << ": clock" << ";"; |
||||
|
return stream; |
||||
|
} |
||||
|
|
||||
|
} // namespace prism
|
||||
|
} // namespace storm
|
||||
@ -0,0 +1,37 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include <map> |
||||
|
|
||||
|
#include "storm/storage/prism/Variable.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace prism { |
||||
|
class ClockVariable : public Variable { |
||||
|
public: |
||||
|
// Create default implementations of constructors/assignment. |
||||
|
ClockVariable() = default; |
||||
|
ClockVariable(ClockVariable const& other) = default; |
||||
|
ClockVariable& operator=(ClockVariable const& other)= default; |
||||
|
ClockVariable(ClockVariable&& other) = default; |
||||
|
ClockVariable& operator=(ClockVariable&& other) = default; |
||||
|
|
||||
|
/*! |
||||
|
* Creates a clock variable |
||||
|
* |
||||
|
* @param variable The expression variable associated with this variable. |
||||
|
* @param filename The filename in which the variable is defined. |
||||
|
* @param lineNumber The line number in which the variable is defined. |
||||
|
*/ |
||||
|
ClockVariable(storm::expressions::Variable const& variable, bool observable, std::string const& filename = "", uint_fast64_t lineNumber = 0); |
||||
|
|
||||
|
/*! |
||||
|
* Sets a missing initial value (note that for clock variables, this is always zero) |
||||
|
*/ |
||||
|
virtual void createMissingInitialValue() override; |
||||
|
|
||||
|
friend std::ostream& operator<<(std::ostream& stream, ClockVariable const& variable); |
||||
|
}; |
||||
|
|
||||
|
} // namespace prism |
||||
|
} // namespace storm |
||||
|
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue