aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard/id.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-18 17:48:14 -0800
committerJosh Blum <josh@joshknows.com>2010-02-18 17:48:14 -0800
commit6fdaccea1fba15b754945d9be7da0ed4a3861633 (patch)
treea5822f02409cc2d69f0566b4ea6e787b0d8ca43d /host/lib/usrp/dboard/id.cpp
parentb4e5df4080b276ff1bf7cf896bd60630cdaab652 (diff)
downloaduhd-6fdaccea1fba15b754945d9be7da0ed4a3861633.tar.gz
uhd-6fdaccea1fba15b754945d9be7da0ed4a3861633.tar.bz2
uhd-6fdaccea1fba15b754945d9be7da0ed4a3861633.zip
Added special case for empty dboard slot (none id 0xffff)
Added error handling in the dboard base classes for mishandling the none id. Added better to string function for the dboard ids. Added get methods for dboard classes to get their ids.
Diffstat (limited to 'host/lib/usrp/dboard/id.cpp')
-rw-r--r--host/lib/usrp/dboard/id.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/host/lib/usrp/dboard/id.cpp b/host/lib/usrp/dboard/id.cpp
index 80162240e..b62e469de 100644
--- a/host/lib/usrp/dboard/id.cpp
+++ b/host/lib/usrp/dboard/id.cpp
@@ -21,7 +21,7 @@
using namespace uhd::usrp::dboard;
-std::ostream& operator<<(std::ostream &os, const dboard_id_t &id){
+std::string id::to_string(const dboard_id_t &id){
//map the dboard ids to string representations
uhd::dict<dboard_id_t, std::string> id_to_str;
id_to_str[ID_NONE] = "none";
@@ -29,11 +29,6 @@ std::ostream& operator<<(std::ostream &os, const dboard_id_t &id){
id_to_str[ID_BASIC_RX] = "basic rx";
//get the string representation
- if (id_to_str.has_key(id)){
- os << id_to_str[id];
- }
- else{
- os << boost::format("dboard id %u") % unsigned(id);
- }
- return os;
+ std::string name = (id_to_str.has_key(id))? id_to_str[id] : "unknown";
+ return str(boost::format("%s (0x%.4x)") % name % id);
}