diff options
author | Ashish Chaudhari <ashish@ettus.com> | 2016-02-24 17:11:27 -0800 |
---|---|---|
committer | Ashish Chaudhari <ashish@ettus.com> | 2016-02-26 14:23:55 -0800 |
commit | 586944ec2bc991d1b96c8698e5da8b39b3d36f9a (patch) | |
tree | 068f26481fb3ec669de53b0b383e215978d8f6c8 /host/lib/experts/expert_nodes.hpp | |
parent | 6db9ac785ca5f62e58cf792f0525b37b16a87bdf (diff) | |
download | uhd-586944ec2bc991d1b96c8698e5da8b39b3d36f9a.tar.gz uhd-586944ec2bc991d1b96c8698e5da8b39b3d36f9a.tar.bz2 uhd-586944ec2bc991d1b96c8698e5da8b39b3d36f9a.zip |
experts: Multiple minor fixes/enhancements
- Fixed segfault issue for graph modification errors
- Demangled node type names and added quotes to "dot" labels to allow fully qualified C++ names
- add_prop_node functions initialize the property objects in the tree in addition to data nodes
- Passed in resolve mutex to desired data node correctly
- Added == and != operators to data accessors
Diffstat (limited to 'host/lib/experts/expert_nodes.hpp')
-rw-r--r-- | host/lib/experts/expert_nodes.hpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/host/lib/experts/expert_nodes.hpp b/host/lib/experts/expert_nodes.hpp index 69ecfa661..235ee489f 100644 --- a/host/lib/experts/expert_nodes.hpp +++ b/host/lib/experts/expert_nodes.hpp @@ -25,6 +25,7 @@ #include <boost/foreach.hpp> #include <boost/thread/recursive_mutex.hpp> #include <boost/thread.hpp> +#include <boost/units/detail/utility.hpp> #include <memory> #include <list> @@ -114,7 +115,8 @@ namespace uhd { namespace experts { // Basic info virtual const std::string& get_dtype() const { - static const std::string dtype(typeid(data_t).name()); + static const std::string dtype( + boost::units::detail::demangle(typeid(data_t).name())); return dtype; } @@ -268,7 +270,8 @@ namespace uhd { namespace experts { _datanode = dynamic_cast< data_node_t<data_t>* >(&node()); if (_datanode == NULL) { throw uhd::type_error("Expected data type for node " + n + - " was " + typeid(data_t).name() + " but got " + node().get_dtype()); + " was " + boost::units::detail::demangle(typeid(data_t).name()) + + " but got " + node().get_dtype()); } } @@ -302,6 +305,14 @@ namespace uhd { namespace experts { inline operator const data_t&() const { return get(); } + + inline bool operator==(const data_t& rhs) { + return get() == rhs; + } + + inline bool operator!=(const data_t& rhs) { + return !(get() == rhs); + } }; /*!--------------------------------------------------------- @@ -319,13 +330,21 @@ namespace uhd { namespace experts { retriever, node, ACCESS_WRITER) {} inline const data_t& get() const { - return data_accessor_base<data_t>::_node.get(); + return data_accessor_base<data_t>::_datanode->get(); } inline operator const data_t&() const { return get(); } + inline bool operator==(const data_t& rhs) { + return get() == rhs; + } + + inline bool operator!=(const data_t& rhs) { + return !(get() == rhs); + } + inline void set(const data_t& value) { data_accessor_base<data_t>::_datanode->set(value); } |