aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/experts/expert_nodes.hpp
diff options
context:
space:
mode:
authorAshish Chaudhari <ashish@ettus.com>2016-03-07 17:43:01 -0800
committerAshish Chaudhari <ashish@ettus.com>2016-03-21 16:49:46 -0700
commit98dba897268a8c7f6e2eaf807c83502b8835f6da (patch)
treed4b23a5e94cdd1d500c91fb5a45ae052e9f9da51 /host/lib/experts/expert_nodes.hpp
parent00bdb2b164ba268ae0a4efa8d0ada70d05f7cdb5 (diff)
downloaduhd-98dba897268a8c7f6e2eaf807c83502b8835f6da.tar.gz
uhd-98dba897268a8c7f6e2eaf807c83502b8835f6da.tar.bz2
uhd-98dba897268a8c7f6e2eaf807c83502b8835f6da.zip
experts: Print values of data nodes when debugging
Diffstat (limited to 'host/lib/experts/expert_nodes.hpp')
-rw-r--r--host/lib/experts/expert_nodes.hpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/host/lib/experts/expert_nodes.hpp b/host/lib/experts/expert_nodes.hpp
index c89f4f3a8..dc5cc934b 100644
--- a/host/lib/experts/expert_nodes.hpp
+++ b/host/lib/experts/expert_nodes.hpp
@@ -59,6 +59,8 @@ namespace uhd { namespace experts {
virtual const std::string& get_dtype() const = 0;
+ virtual std::string to_string() const = 0;
+
// Graph resolution specific
virtual bool is_dirty() const = 0;
virtual void mark_clean() = 0;
@@ -81,6 +83,23 @@ namespace uhd { namespace experts {
const std::string _name;
};
+ class data_node_printer {
+ public:
+ //Generic implementation
+ template<typename data_t>
+ static std::string print(const data_t& val) {
+ std::ostringstream os;
+ os << val;
+ return os.str();
+ }
+
+ static std::string print(const boost::uint8_t& val) {
+ std::ostringstream os;
+ os << int(val);
+ return os.str();
+ }
+ };
+
/*!---------------------------------------------------------
* class data_node_t
*
@@ -120,6 +139,10 @@ namespace uhd { namespace experts {
return dtype;
}
+ virtual std::string to_string() const {
+ return data_node_printer::print(get());
+ }
+
inline node_author_t get_author() const {
return _author;
}
@@ -431,6 +454,10 @@ namespace uhd { namespace experts {
return dtype;
}
+ virtual std::string to_string() const {
+ return "<worker>";
+ }
+
// Workers don't have callbacks so implement stubs
virtual void set_write_callback(const callback_func_t&) {}
virtual bool has_write_callback() const { return false; }