USRP Hardware Driver and USRP Manual: dirty_tracked.hpp Source File

| USRP Hardware Driver and USRP Manual Version: 4.8.0.makepkg-0-g308126a4 UHD and USRP Manual |

Loading...
Searching...
No Matches
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>
24 class dirty_tracked
25{
26public:
30 dirty_tracked()
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
47 dirty_tracked(const uhd::dirty_tracked<data_t>&) = default;
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
103 inline dirty_tracked& operator=(const dirty_tracked& source)
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
uhd::dirty_tracked
Definition dirty_tracked.hpp:25
uhd::dirty_tracked::force_dirty
void force_dirty()
Definition dirty_tracked.hpp:77
uhd::dirty_tracked::dirty_tracked
dirty_tracked(const data_t &value)
Definition dirty_tracked.hpp:40
uhd::dirty_tracked::is_dirty
bool is_dirty() const
Definition dirty_tracked.hpp:61
uhd::dirty_tracked::operator=
dirty_tracked & operator=(const data_t &value)
Definition dirty_tracked.hpp:87
uhd::dirty_tracked::dirty_tracked
dirty_tracked()
Definition dirty_tracked.hpp:30
uhd::dirty_tracked::mark_clean
void mark_clean()
Definition dirty_tracked.hpp:69
uhd::dirty_tracked::get
const data_t & get() const
Definition dirty_tracked.hpp:52
uhd::dirty_tracked::dirty_tracked
dirty_tracked(const uhd::dirty_tracked< data_t > &)=default
uhd::dirty_tracked::operator=
dirty_tracked & operator=(const dirty_tracked &source)
Definition dirty_tracked.hpp:103
uhd
Definition build_info.hpp:12