Browse Source

Environment does no longer require that unused setting modules still have to be registered.

tempestpy_adaptions
TimQu 7 years ago
parent
commit
1e4b81812c
  1. 17
      src/storm/environment/SubEnvironment.cpp
  2. 4
      src/storm/environment/SubEnvironment.h

17
src/storm/environment/SubEnvironment.cpp

@ -16,31 +16,44 @@
namespace storm {
template<typename EnvironmentType>
SubEnvironment<EnvironmentType>::SubEnvironment() : subEnv(std::make_unique<EnvironmentType>()) {
SubEnvironment<EnvironmentType>::SubEnvironment() : subEnv(nullptr) {
// Intentionally left empty
}
template<typename EnvironmentType>
SubEnvironment<EnvironmentType>::SubEnvironment(SubEnvironment const& other) : subEnv(new EnvironmentType(*other.subEnv)) {
SubEnvironment<EnvironmentType>::SubEnvironment(SubEnvironment const& other) : subEnv(other.subEnv ? new EnvironmentType(*other.subEnv) : nullptr) {
// Intentionally left empty
}
template<typename EnvironmentType>
SubEnvironment<EnvironmentType>& SubEnvironment<EnvironmentType>::operator=(SubEnvironment const& other) {
if (other.subEnv) {
subEnv = std::make_unique<EnvironmentType>(*other.subEnv);
} else {
subEnv.reset();
}
return *this;
}
template<typename EnvironmentType>
EnvironmentType const& SubEnvironment<EnvironmentType>::get() const {
assertInitialized();
return *subEnv;
}
template<typename EnvironmentType>
EnvironmentType& SubEnvironment<EnvironmentType>::get() {
assertInitialized();
return *subEnv;
}
template<typename EnvironmentType>
void SubEnvironment<EnvironmentType>::assertInitialized() const {
if (!subEnv) {
subEnv = std::make_unique<EnvironmentType>();
}
}
template class SubEnvironment<InternalEnvironment>;
template class SubEnvironment<MultiObjectiveModelCheckerEnvironment>;

4
src/storm/environment/SubEnvironment.h

@ -16,8 +16,8 @@ namespace storm {
EnvironmentType& get();
private:
std::unique_ptr<EnvironmentType> subEnv;
void assertInitialized() const;
mutable std::unique_ptr<EnvironmentType> subEnv;
};
}
Loading…
Cancel
Save