USRP Hardware Driver and USRP Manual Version: 4.1.0.1
UHD and USRP Manual
dirty_tracked.hpp
Go to the documentation of this file.
1//
2// Copyright 2010-2015 Ettus Research LLC
3// Copyright 2018 Ettus Research, a National Instruments Company
4//
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
7
8#pragma once
9
10namespace uhd {
23template <typename data_t>
25{
26public:
31 : _data()
32 , // data_t must have a default ctor
33 _dirty(true)
34 {
35 }
36
40 dirty_tracked(const data_t& value)
41 : _data(value)
42 , // data_t must have a copy ctor
43 _dirty(true)
44 {
45 }
46
48
52 inline const data_t& get() const
53 {
54 return _data;
55 }
56
61 inline bool is_dirty() const
62 {
63 return _dirty;
64 }
65
69 inline void mark_clean()
70 {
71 _dirty = false;
72 }
73
77 inline void force_dirty()
78 {
79 _dirty = true;
80 }
81
87 inline dirty_tracked& operator=(const data_t& value)
88 {
89 if (!(_data == value)) { // data_t must have an equality operator
90 _dirty = true;
91 _data = value; // data_t must have an assignment operator
92 }
93 return *this;
94 }
95
104 {
105 if (!(_data == source._data)) {
106 _dirty = true;
107 _data = source._data;
108 }
109 return *this;
110 }
111
115 inline operator const data_t&() const
116 {
117 return get();
118 }
119
120private:
121 data_t _data;
122 bool _dirty;
123};
124
125} // namespace uhd
Definition: dirty_tracked.hpp:25
void force_dirty()
Definition: dirty_tracked.hpp:77
dirty_tracked(const data_t &value)
Definition: dirty_tracked.hpp:40
bool is_dirty() const
Definition: dirty_tracked.hpp:61
dirty_tracked & operator=(const data_t &value)
Definition: dirty_tracked.hpp:87
dirty_tracked()
Definition: dirty_tracked.hpp:30
void mark_clean()
Definition: dirty_tracked.hpp:69
const data_t & get() const
Definition: dirty_tracked.hpp:52
dirty_tracked(const uhd::dirty_tracked< data_t > &)=default
dirty_tracked & operator=(const dirty_tracked &source)
Definition: dirty_tracked.hpp:103
source
Identify the source of calibration data, i.e., where was it stored.
Definition: database.hpp:22
Definition: build_info.hpp:12