From 6fdaccea1fba15b754945d9be7da0ed4a3861633 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 18 Feb 2010 17:48:14 -0800 Subject: 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. --- host/lib/usrp/dboard/id.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'host/lib/usrp/dboard/id.cpp') 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 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); } -- cgit v1.2.3