Storm
1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SubEnvironment.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <memory>
4
5
namespace
storm
{
6
7
// The member functions below are declared but defined out-of-line afterwards.
8
// This is needed because `extern template class` otherwise still implicitly inlines and instantiates member functions.
9
10
template
<
typename
EnvironmentType>
11
class
SubEnvironment
{
12
public
:
13
SubEnvironment
();
14
SubEnvironment
(
SubEnvironment
const
& other);
15
SubEnvironment<EnvironmentType>
&
operator=
(
SubEnvironment
const
& other);
16
EnvironmentType
const
&
get
()
const
;
17
EnvironmentType&
get
();
18
19
private
:
20
void
assertInitialized()
const
;
21
mutable
std::unique_ptr<EnvironmentType> subEnv;
22
};
23
24
template
<
typename
EnvironmentType>
25
SubEnvironment<EnvironmentType>::SubEnvironment
() : subEnv(nullptr) {
26
// Intentionally left empty
27
}
28
29
template
<
typename
EnvironmentType>
30
SubEnvironment<EnvironmentType>::SubEnvironment
(
SubEnvironment
const
& other) : subEnv(other.subEnv ? new EnvironmentType(*other.subEnv) : nullptr) {
31
// Intentionally left empty
32
}
33
34
template
<
typename
EnvironmentType>
35
SubEnvironment<EnvironmentType>
&
SubEnvironment<EnvironmentType>::operator=
(
SubEnvironment
const
& other) {
36
if
(other.subEnv) {
37
subEnv = std::make_unique<EnvironmentType>(*other.subEnv);
38
}
else
{
39
subEnv.reset();
40
}
41
return
*
this
;
42
}
43
44
template
<
typename
EnvironmentType>
45
EnvironmentType
const
&
SubEnvironment<EnvironmentType>::get
()
const
{
46
assertInitialized();
47
return
*subEnv;
48
}
49
50
template
<
typename
EnvironmentType>
51
EnvironmentType&
SubEnvironment<EnvironmentType>::get
() {
52
assertInitialized();
53
return
*subEnv;
54
}
55
56
template
<
typename
EnvironmentType>
57
void
SubEnvironment<EnvironmentType>::assertInitialized()
const
{
58
if
(!subEnv) {
59
subEnv = std::make_unique<EnvironmentType>();
60
}
61
}
62
63
}
// namespace storm
storm::SubEnvironment::operator=
SubEnvironment< EnvironmentType > & operator=(SubEnvironment const &other)
Definition
SubEnvironment.h:35
storm::SubEnvironment::SubEnvironment
SubEnvironment()
Definition
SubEnvironment.h:25
storm::SubEnvironment::get
EnvironmentType const & get() const
Definition
SubEnvironment.h:45
storm
Definition
AutomaticSettings.cpp:13
src
storm
environment
SubEnvironment.h
Generated by
1.15.0