Documentation of
CSL
include
scopedProperty.h
Go to the documentation of this file.
1
// This file is part of MARTY.
2
//
3
// MARTY is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, either version 3 of the License, or
6
// (at your option) any later version.
7
//
8
// MARTY is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
// GNU General Public License for more details.
12
//
13
// You should have received a copy of the GNU General Public License
14
// along with MARTY. If not, see <https://www.gnu.org/licenses/>.
15
23
#ifndef SCOPEDPROPERTY_H_INCLUDED
24
#define SCOPEDPROPERTY_H_INCLUDED
25
26
#include <iostream>
27
namespace
csl
{
28
29
30
template
<
class
PropType>
31
class
ScopedProperty
{
32
33
private
:
34
35
PropType initialValue;
36
37
PropType *prop;
38
39
public
:
40
41
ScopedProperty
(PropType* variable,
42
PropType value)
43
:initialValue(*variable),
44
prop(variable)
45
{
46
*prop = value;
47
}
48
49
~
ScopedProperty
()
50
{
51
*prop = initialValue;
52
}
53
};
54
55
}
56
57
#endif
csl
Namespace for csl library.
Definition:
abreviation.h:34
csl::ScopedProperty
Definition:
scopedProperty.h:31
Generated by
1.8.13