USRP Hardware Driver and USRP Manual  Version: 4.6.0.0
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 
10 namespace uhd {
23 template <typename data_t>
25 {
26 public:
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 
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 
120 private:
121  data_t _data;
122  bool _dirty;
123 };
124 
125 } // namespace uhd
void mark_clean()
Definition: dirty_tracked.hpp:69
dirty_tracked & operator=(const data_t &value)
Definition: dirty_tracked.hpp:87
bool is_dirty() const
Definition: dirty_tracked.hpp:61
Definition: build_info.hpp:12
Definition: dirty_tracked.hpp:24
dirty_tracked(const data_t &value)
Definition: dirty_tracked.hpp:40
void force_dirty()
Definition: dirty_tracked.hpp:77
source
Identify the source of calibration data, i.e., where was it stored.
Definition: database.hpp:23
dirty_tracked & operator=(const dirty_tracked &source)
Definition: dirty_tracked.hpp:103
dirty_tracked()
Definition: dirty_tracked.hpp:30