mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [
git repo
]
changeable.hpp
Go to the documentation of this file.
1
/** \file changeable.hpp
2
* \brief A simple class to track member data changes
3
*
4
* \author Jared R. Males (jaredmales@gmail.com)
5
*
6
* \ingroup utils_files
7
*
8
*/
9
10
#ifndef mx_base_changeable_hpp
11
#define mx_base_changeable_hpp
12
13
14
namespace
mx
15
{
16
namespace
base
17
{
18
19
/// A simple class to track member data changes.
20
/** Maintains a monotonic counter that derived classes increment anytime a member
21
* datum is changed. This allows for, say, re-initializing automatically on a subsequent
22
* call to a function.
23
*
24
* \ingroup base
25
*/
26
class
changeable
27
{
28
public
:
29
30
/// The integer type of the counter.
31
typedef
uint64_t
changeT
;
32
33
private
:
34
35
/// The counter itself.
36
changeT
m_change {0};
37
38
public
:
39
40
/// Increment the counter
41
/** Call this function anytime the derived class changes something important.
42
*
43
*/
44
void
changed
()
45
{
46
++m_change;
47
}
48
49
/// Get the value of the counter
50
/** Get this at a checkpoint and compare it later to decide if any
51
* action should be taken.
52
*/
53
changeT
change
()
54
{
55
return
m_change;
56
}
57
};
58
59
}
60
}
61
62
63
#endif
//mx_base_changeable_hpp
mx::base::changeable
A simple class to track member data changes.
Definition:
changeable.hpp:27
mx::base::changeable::change
changeT change()
Get the value of the counter.
Definition:
changeable.hpp:53
mx::base::changeable::changeT
uint64_t changeT
The integer type of the counter.
Definition:
changeable.hpp:31
mx::base::changeable::changed
void changed()
Increment the counter.
Definition:
changeable.hpp:44
mx
The mxlib c++ namespace.
Definition:
mxError.hpp:107
base
changeable.hpp
Generated on Sun Nov 26 2023 10:58:11 for mxlib by
1.9.1