Browse Source

Using raw pointers for manager in Variable.h since weak_ptr::lock() often seems to be a bottle neck during, e.g., model building.

tempestpy_adaptions
Tim Quatmann 5 years ago
parent
commit
e945f28a86
  1. 7
      src/storm/storage/expressions/Variable.cpp
  2. 2
      src/storm/storage/expressions/Variable.h

7
src/storm/storage/expressions/Variable.cpp

@ -3,11 +3,11 @@
namespace storm { namespace storm {
namespace expressions { namespace expressions {
Variable::Variable() {
Variable::Variable() : manager(nullptr) {
// Intentionally left empty. // Intentionally left empty.
} }
Variable::Variable(std::shared_ptr<ExpressionManager const> const& manager, uint_fast64_t index) : manager(manager), index(index) {
Variable::Variable(std::shared_ptr<ExpressionManager const> const& manager, uint_fast64_t index) : manager(manager.get()), index(index) {
// Intentionally left empty. // Intentionally left empty.
} }
@ -52,7 +52,8 @@ namespace storm {
} }
ExpressionManager const& Variable::getManager() const { ExpressionManager const& Variable::getManager() const {
return *manager.lock();
STORM_LOG_ASSERT(manager != nullptr, "The variable does not have a manager.");
return *manager;
} }
bool Variable::hasBooleanType() const { bool Variable::hasBooleanType() const {

2
src/storm/storage/expressions/Variable.h

@ -138,7 +138,7 @@ namespace storm {
private: private:
// The manager that is responsible for this variable. // The manager that is responsible for this variable.
std::weak_ptr<ExpressionManager const> manager;
ExpressionManager const* manager;
// The index of the variable. // The index of the variable.
uint_fast64_t index; uint_fast64_t index;

Loading…
Cancel
Save