17namespace uhd {
namespace rfnoc {
37 : _id(id), _source_info(source_info)
39 if(_id.find(
':') != std::string::npos) {
40 throw uhd::value_error(
"Property ID `" + _id +
"' contains invalid character!");
76 return static_cast<uint8_t
>(_access_mode) & 0x1;
82 return static_cast<uint8_t
>(_access_mode) & 0x2;
120 friend class prop_accessor_t;
123 virtual void mark_clean() = 0;
135 const std::string _id;
148template <
typename data_t>
158 const std::string&
id,
const data_t& value,
const res_source_info& source_info);
170 return _data.is_dirty();
184 if (!is_type_equal(rhs)) {
192 return std::unique_ptr<property_base_t>(
199 set(uhd::cast::from_str<data_t>(new_val_str));
202 std::string(
"Property ") +
get_id() +
":" + ex.what());
214 void set(
const data_t& value)
220 if (_data.get() != value) {
223 +
"' with a new value after it was locked!");
227 +
get_id() +
"' without access privileges!");
236 if (!_data.is_dirty()) {
239 +
"' with dirty flag after it was locked!");
243 +
get_id() +
"' without access privileges!");
256 +
"' before it was initialized!");
262 +
"' without access privileges!");
265 operator const data_t&()
const
282 void mark_clean()
override
291 std::string(
"Unable to forward invalid property ") +
get_id());
293 property_t<data_t>* prop_ptr =
dynamic_cast<property_t<data_t>*
>(next_prop);
294 if (prop_ptr ==
nullptr) {
296 + next_prop->get_id() +
" to the same type as property "
300 prop_ptr->set(
get());
305 return dynamic_cast<property_t<data_t>*
>(other_prop) !=
nullptr;
308 dirty_tracked<data_t> _data;
Definition: property.hpp:26
const std::string & get_id() const
Gets the ID (name) of this property.
Definition: property.hpp:50
virtual void force_dirty()=0
const res_source_info & get_src_info() const
Return the source info for this property.
Definition: property.hpp:56
virtual bool equal(property_base_t *rhs) const =0
Return true if rhs has the same type and value.
access_t
Definition: property.hpp:28
@ NONE
Neither reading nor writing to this property is permitted.
Definition: property.hpp:29
@ RWLOCKED
Definition: property.hpp:32
property_base_t(const std::string &id, const res_source_info &source_info)
Definition: property.hpp:36
virtual void set_from_str(const std::string &new_val_str)=0
virtual bool is_valid() const =0
Query this property's valid flag.
virtual std::unique_ptr< property_base_t > clone(res_source_info)
Create a copy of this property.
Definition: property.hpp:102
access_t get_access_mode() const
Return the current access mode.
Definition: property.hpp:86
virtual ~property_base_t()
Definition: property.hpp:44
bool write_access_granted() const
Returns true if this property can be written to.
Definition: property.hpp:80
bool read_access_granted() const
Returns true if this property can be read.
Definition: property.hpp:74
virtual bool is_dirty() const =0
Query this property's dirty flag.
Definition: property.hpp:150
const data_t & get() const
Get the value of this property.
Definition: property.hpp:251
void set(const data_t &value)
Returns the source info for the property.
Definition: property.hpp:214
bool is_dirty() const override
Returns the dirty state of this property.
Definition: property.hpp:168
property_t(const std::string &id, data_t &&value, const res_source_info &source_info)
Definition: property.ipp:10
property_t< data_t > & operator=(const data_t &value)
Definition: property.hpp:275
bool is_valid() const override
Query this property's valid flag.
Definition: property.hpp:177
void set_from_str(const std::string &new_val_str) override
Definition: property.hpp:196
data_t value_type
We want to be good C++ citizens.
Definition: property.hpp:153
bool operator==(const data_t &rhs)
Definition: property.hpp:270
bool equal(property_base_t *rhs) const override
Return true if rhs has the same type and value.
Definition: property.hpp:182
void force_dirty() override
Definition: property.hpp:231
std::unique_ptr< property_base_t > clone(res_source_info new_src_info) override
Create a copy of this property.
Definition: property.hpp:190
property_t(const property_t< data_t > &prop)=default
#define UHD_API
Definition: config.h:70
Definition: build_info.hpp:12
Definition: exception.hpp:169
Definition: exception.hpp:158
Definition: exception.hpp:282
Definition: res_source_info.hpp:18
Definition: exception.hpp:133
Definition: exception.hpp:97
Definition: exception.hpp:109