Browse Source

Fixed seg fault when building model valuations

main
TimQu 8 years ago
parent
commit
d655621ea1
  1. 2
      src/storm/builder/ExplicitModelBuilder.h
  2. 8
      src/storm/storage/expressions/SimpleValuation.cpp
  3. 4
      src/storm/storage/expressions/Valuation.cpp
  4. 8
      src/storm/storage/expressions/Valuation.h

2
src/storm/builder/ExplicitModelBuilder.h

@ -79,7 +79,7 @@ namespace storm {
// A flag that indicates whether or not to store the state information after successfully building the // A flag that indicates whether or not to store the state information after successfully building the
// model. If it is to be preserved, it can be retrieved via the appropriate methods after a successful // model. If it is to be preserved, it can be retrieved via the appropriate methods after a successful
// call to <code>translateProgram</code>.
// call to <code>build</code>.
bool buildStateValuations; bool buildStateValuations;
}; };

8
src/storm/storage/expressions/SimpleValuation.cpp

@ -19,7 +19,7 @@ namespace storm {
// Intentionally left empty. // Intentionally left empty.
} }
SimpleValuation::SimpleValuation(SimpleValuation const& other) : Valuation(other.getManager().getSharedPointer()) {
SimpleValuation::SimpleValuation(SimpleValuation const& other) : Valuation(other.getManagerAsSharedPtr()) {
if (this != &other) { if (this != &other) {
booleanValues = other.booleanValues; booleanValues = other.booleanValues;
integerValues = other.integerValues; integerValues = other.integerValues;
@ -29,7 +29,7 @@ namespace storm {
SimpleValuation& SimpleValuation::operator=(SimpleValuation const& other) { SimpleValuation& SimpleValuation::operator=(SimpleValuation const& other) {
if (this != &other) { if (this != &other) {
this->setManager(other.getManager().getSharedPointer());
this->setManager(other.getManagerAsSharedPtr());
booleanValues = other.booleanValues; booleanValues = other.booleanValues;
integerValues = other.integerValues; integerValues = other.integerValues;
rationalValues = other.rationalValues; rationalValues = other.rationalValues;
@ -37,7 +37,7 @@ namespace storm {
return *this; return *this;
} }
SimpleValuation::SimpleValuation(SimpleValuation&& other) : Valuation(other.getManager().getSharedPointer()) {
SimpleValuation::SimpleValuation(SimpleValuation&& other) : Valuation(other.getManagerAsSharedPtr()) {
if (this != &other) { if (this != &other) {
booleanValues = std::move(other.booleanValues); booleanValues = std::move(other.booleanValues);
integerValues = std::move(other.integerValues); integerValues = std::move(other.integerValues);
@ -47,7 +47,7 @@ namespace storm {
SimpleValuation& SimpleValuation::operator=(SimpleValuation&& other) { SimpleValuation& SimpleValuation::operator=(SimpleValuation&& other) {
if (this != &other) { if (this != &other) {
this->setManager(other.getManager().getSharedPointer());
this->setManager(other.getManagerAsSharedPtr());
booleanValues = std::move(other.booleanValues); booleanValues = std::move(other.booleanValues);
integerValues = std::move(other.integerValues); integerValues = std::move(other.integerValues);
rationalValues = std::move(other.rationalValues); rationalValues = std::move(other.rationalValues);

4
src/storm/storage/expressions/Valuation.cpp

@ -15,6 +15,10 @@ namespace storm {
return *manager; return *manager;
} }
std::shared_ptr<ExpressionManager const> const& Valuation::getManagerAsSharedPtr() const {
return manager;
}
void Valuation::setManager(std::shared_ptr<ExpressionManager const> const& manager) { void Valuation::setManager(std::shared_ptr<ExpressionManager const> const& manager) {
this->manager = manager; this->manager = manager;
} }

8
src/storm/storage/expressions/Valuation.h

@ -101,6 +101,14 @@ namespace storm {
ExpressionManager const& getManager() const; ExpressionManager const& getManager() const;
protected: protected:
/*!
* Retrieves the manager responsible for the variables of this valuation.
*
* @return The manager.
*/
std::shared_ptr<ExpressionManager const> const& getManagerAsSharedPtr() const;
/*! /*!
* Sets the manager responsible for the variables in this valuation. * Sets the manager responsible for the variables in this valuation.
* *

Loading…
Cancel
Save