  | 
  
    USRP Hardware Driver and USRP Manual
    Version: 4.8.0.0
    
   UHD and USRP Manual 
   | 
           
 | 
 
 
 
 
Go to the documentation of this file.
   17 namespace uhd { 
namespace rfnoc {
 
   20 class prop_accessor_t;
 
   37         : _id(id), _source_info(source_info)
 
   39         if (_id.find(
':') != std::string::npos) {
 
   41                 "Property ID `" + _id + 
"' contains invalid character!");
 
   66     virtual bool is_dirty() 
const = 0;
 
   72     virtual bool is_valid() 
const = 0;
 
   77         return static_cast<uint8_t
>(_access_mode) & 0x1;
 
   83         return static_cast<uint8_t
>(_access_mode) & 0x2;
 
  108     virtual void force_dirty() = 0;
 
  118     virtual void set_from_str(
const std::string& new_val_str) = 0;
 
  121     friend class prop_accessor_t;
 
  124     virtual void mark_clean() = 0;
 
  136     const std::string _id;
 
  149 template <
typename data_t>
 
  159         const std::string& 
id, 
const data_t& value, 
const res_source_info& source_info);
 
  171         return _data.is_dirty();
 
  185         if (!is_type_equal(rhs)) {
 
  193         return std::unique_ptr<property_base_t>(
 
  200             set(uhd::cast::from_str<data_t>(new_val_str));
 
  203                 std::string(
"Property ") + get_id() + 
":" + ex.what());
 
  215     void set(
const data_t& value)
 
  217         if (write_access_granted()) {
 
  220         } 
else if (get_access_mode() == RWLOCKED) {
 
  221             if (_data.get() != value) {
 
  223                                          + get_id() + 
"@" + get_src_info().to_string()
 
  224                                          + 
"' with a new value after it was locked!");
 
  228                                     + get_id() + 
"' without access privileges!");
 
  234         if (write_access_granted()) {
 
  236         } 
else if (get_access_mode() == RWLOCKED) {
 
  237             if (!_data.is_dirty()) {
 
  240                                          + 
"' with dirty flag after it was locked!");
 
  244                                     + get_id() + 
"' without access privileges!");
 
  256                                     + get_id() + 
"@" + get_src_info().to_string()
 
  257                                     + 
"' before it was initialized!");
 
  259         if (read_access_granted()) {
 
  263                                 + 
"' without access privileges!");
 
  266     operator const data_t&() 
const 
  283     void mark_clean()
 override 
  288     void forward(property_base_t* next_prop)
 override 
  292                 std::string(
"Unable to forward invalid property ") + get_id());
 
  294         property_t<data_t>* prop_ptr = 
dynamic_cast<property_t<data_t>*
>(next_prop);
 
  295         if (prop_ptr == 
nullptr) {
 
  297                                   + next_prop->get_id() + 
" to the same type as property " 
  301         prop_ptr->set(get());
 
  304     bool is_type_equal(property_base_t* other_prop)
 const override 
  306         return dynamic_cast<property_t<data_t>*
>(other_prop) != 
nullptr;
 
  309     dirty_tracked<data_t> _data;
 
  
 
void set_from_str(const std::string &new_val_str) override
Definition: property.hpp:197
 
bool write_access_granted() const
Returns true if this property can be written to.
Definition: property.hpp:81
 
Definition: res_source_info.hpp:17
 
void force_dirty() override
Definition: property.hpp:232
 
Definition: exception.hpp:157
 
std::unique_ptr< property_base_t > clone(res_source_info new_src_info) override
Create a copy of this property.
Definition: property.hpp:191
 
Definition: exception.hpp:108
 
Definition: exception.hpp:281
 
void set(const data_t &value)
Returns the source info for the property.
Definition: property.hpp:215
 
size_t value_type
We want to be good C++ citizens.
Definition: property.hpp:154
 
bool read_access_granted() const
Returns true if this property can be read.
Definition: property.hpp:75
 
const std::string & get_id() const
Gets the ID (name) of this property.
Definition: property.hpp:51
 
bool operator==(const data_t &rhs)
Definition: property.hpp:271
 
const data_t & get() const
Get the value of this property.
Definition: property.hpp:252
 
#define UHD_API
Definition: config.h:87
 
property_t< data_t > & operator=(const data_t &value)
Definition: property.hpp:276
 
bool is_valid() const override
Query this property's valid flag.
Definition: property.hpp:178
 
property_base_t(const std::string &id, const res_source_info &source_info)
Definition: property.hpp:36
 
Definition: exception.hpp:168
 
const res_source_info & get_src_info() const
Return the source info for this property.
Definition: property.hpp:57
 
Definition: property.hpp:150
 
access_t
Definition: property.hpp:28
 
Definition: build_info.hpp:12
 
@ NONE
Neither reading nor writing to this property is permitted.
Definition: property.hpp:29
 
Definition: property.hpp:25
 
Definition: exception.hpp:132
 
Definition: exception.hpp:96
 
virtual ~property_base_t()
Definition: property.hpp:45
 
bool equal(property_base_t *rhs) const override
Return true if rhs has the same type and value.
Definition: property.hpp:183
 
virtual std::unique_ptr< property_base_t > clone(res_source_info)
Create a copy of this property.
Definition: property.hpp:103
 
access_t get_access_mode() const
Return the current access mode.
Definition: property.hpp:87
 
bool is_dirty() const override
Returns the dirty state of this property.
Definition: property.hpp:169
 
#define UHD_API_HEADER
Definition: config.h:88