MINT2
Mint
CachedVar.h
Go to the documentation of this file.
1
11
#ifndef CACHED_VAR_HH
12
#define CACHED_VAR_HH
13
14
// HyperPlot includes
15
16
17
// Root includes
18
19
20
// std includes
21
22
23
template
<
class
T>
24
class
CachedVar
{
25
26
private
:
27
28
bool
_needsUpdate
;
29
T
_cachedVar
;
30
31
public
:
32
33
CachedVar
(
const
T& var = T());
34
35
void
changed
(){
36
_needsUpdate
=
true
;
37
}
38
void
updated
(){
39
_needsUpdate
=
false
;
40
}
41
42
T&
get
(){
return
_cachedVar
;}
43
const
T&
get
()
const
{
return
_cachedVar
;}
44
45
CachedVar
&
operator=
(
const
T& other){
46
_cachedVar
= other;
47
return
*
this
;
48
}
49
50
operator
const
T&() {
51
return
_cachedVar
;
52
}
53
54
bool
isUpdateNeeded
(){
55
return
_needsUpdate
;
56
}
57
58
~CachedVar
(){
59
60
}
61
62
63
};
64
65
template
<
class
T>
CachedVar<T>::CachedVar
(
const
T& var) :
66
_needsUpdate(true),
67
_cachedVar(var)
68
{
69
70
}
71
72
73
#endif
74
CachedVar::updated
void updated()
Definition:
CachedVar.h:38
CachedVar::~CachedVar
~CachedVar()
Definition:
CachedVar.h:58
CachedVar::isUpdateNeeded
bool isUpdateNeeded()
Definition:
CachedVar.h:54
CachedVar::changed
void changed()
Definition:
CachedVar.h:35
CachedVar::operator=
CachedVar & operator=(const T &other)
Definition:
CachedVar.h:45
CachedVar::get
const T & get() const
Definition:
CachedVar.h:43
CachedVar
Definition:
CachedVar.h:24
CachedVar::get
T & get()
Definition:
CachedVar.h:42
CachedVar::_needsUpdate
bool _needsUpdate
Definition:
CachedVar.h:28
CachedVar::_cachedVar
T _cachedVar
Definition:
CachedVar.h:29
CachedVar::CachedVar
CachedVar(const T &var=T())
Definition:
CachedVar.h:65
Generated by
1.8.15