aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-12 18:43:21 -0800
committerJosh Blum <josh@joshknows.com>2010-02-12 18:43:21 -0800
commit259f5babf1e1bc1595ad54c6588c1ff5117dc2e3 (patch)
treecd4e82dfd650b69d9d36d7c95f34bd76ede4972b /lib
parent9fff25f4e5da179ea29ff44278e0415a337870cb (diff)
downloaduhd-259f5babf1e1bc1595ad54c6588c1ff5117dc2e3.tar.gz
uhd-259f5babf1e1bc1595ad54c6588c1ff5117dc2e3.tar.bz2
uhd-259f5babf1e1bc1595ad54c6588c1ff5117dc2e3.zip
Made use of templated dict to replace used of map
and to get rid of utility call.
Diffstat (limited to 'lib')
-rw-r--r--lib/usrp/dboard/id.cpp12
-rw-r--r--lib/usrp/dboard/manager.cpp15
-rw-r--r--lib/usrp/mboard/test.cpp9
-rw-r--r--lib/usrp/usrp.cpp5
4 files changed, 18 insertions, 23 deletions
diff --git a/lib/usrp/dboard/id.cpp b/lib/usrp/dboard/id.cpp
index b55028a11..0f173ef14 100644
--- a/lib/usrp/dboard/id.cpp
+++ b/lib/usrp/dboard/id.cpp
@@ -16,21 +16,19 @@
//
#include <uhd/usrp/dboard/id.hpp>
-#include <boost/assign/list_of.hpp>
#include <boost/format.hpp>
-#include <map>
+#include <uhd/dict.hpp>
using namespace uhd::usrp::dboard;
std::ostream& operator<<(std::ostream &os, const dboard_id_t &id){
//map the dboard ids to string representations
- std::map<dboard_id_t, std::string> id_to_str = boost::assign::map_list_of
- (ID_BASIC_TX, "basic tx")
- (ID_BASIC_RX, "basic rx")
- ;
+ uhd::dict<dboard_id_t, std::string> id_to_str;
+ id_to_str[ID_BASIC_TX] = "basic tx";
+ id_to_str[ID_BASIC_RX] = "basic rx";
//get the string representation
- if (id_to_str.count(id) != 0){
+ if (id_to_str.has_key(id)){
os << id_to_str[id];
}
else{
diff --git a/lib/usrp/dboard/manager.cpp b/lib/usrp/dboard/manager.cpp
index 5005301ba..f6d9a718e 100644
--- a/lib/usrp/dboard/manager.cpp
+++ b/lib/usrp/dboard/manager.cpp
@@ -16,7 +16,6 @@
//
#include <uhd/usrp/dboard/manager.hpp>
-#include <uhd/utils.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/format.hpp>
#include <boost/foreach.hpp>
@@ -51,10 +50,10 @@ static void register_internal_dboards(void){
* storage and registering for dboards
**********************************************************************/
//map a dboard id to a dboard constructor
-static std::map<dboard_id_t, manager::dboard_ctor_t> id_to_ctor_map;
+static uhd::dict<dboard_id_t, manager::dboard_ctor_t> id_to_ctor_map;
//map a dboard constructor to subdevice names
-static std::map<manager::dboard_ctor_t, prop_names_t> ctor_to_names_map;
+static uhd::dict<manager::dboard_ctor_t, prop_names_t> ctor_to_names_map;
void manager::register_subdevs(
dboard_id_t dboard_id,
@@ -117,7 +116,7 @@ static manager::dboard_ctor_t const& get_dboard_ctor(
std::string const& xx_type
){
//verify that there is a registered constructor for this id
- if (id_to_ctor_map.count(dboard_id) == 0){
+ if (not id_to_ctor_map.has_key(dboard_id)){
throw std::runtime_error(str(
boost::format("Unknown %s dboard id: 0x%04x") % xx_type % dboard_id
));
@@ -180,15 +179,15 @@ manager::~manager(void){
}
prop_names_t manager::get_rx_subdev_names(void){
- return get_map_keys(_rx_dboards);
+ return _rx_dboards.get_keys();
}
prop_names_t manager::get_tx_subdev_names(void){
- return get_map_keys(_tx_dboards);
+ return _tx_dboards.get_keys();
}
wax::obj manager::get_rx_subdev(const std::string &subdev_name){
- if (_rx_dboards.count(subdev_name) == 0) throw std::invalid_argument(
+ if (not _rx_dboards.has_key(subdev_name)) throw std::invalid_argument(
str(boost::format("Unknown rx subdev name %s") % subdev_name)
);
//get a link to the rx subdev proxy
@@ -196,7 +195,7 @@ wax::obj manager::get_rx_subdev(const std::string &subdev_name){
}
wax::obj manager::get_tx_subdev(const std::string &subdev_name){
- if (_tx_dboards.count(subdev_name) == 0) throw std::invalid_argument(
+ if (not _tx_dboards.has_key(subdev_name)) throw std::invalid_argument(
str(boost::format("Unknown tx subdev name %s") % subdev_name)
);
//get a link to the tx subdev proxy
diff --git a/lib/usrp/mboard/test.cpp b/lib/usrp/mboard/test.cpp
index b4ac66eb7..c533c97b4 100644
--- a/lib/usrp/mboard/test.cpp
+++ b/lib/usrp/mboard/test.cpp
@@ -16,7 +16,6 @@
//
#include <uhd/usrp/mboard/test.hpp>
-#include <uhd/utils.hpp>
#include <uhd/props.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>
@@ -139,7 +138,7 @@ void test::get(const wax::obj &key_, wax::obj &val){
return;
case MBOARD_PROP_RX_DBOARD:
- if (_dboard_managers.count(name) == 0) throw std::invalid_argument(
+ if (not _dboard_managers.has_key(name)) throw std::invalid_argument(
str(boost::format("Unknown rx dboard name %s") % name)
);
//FIXME store the shell dboard within the class
@@ -150,11 +149,11 @@ void test::get(const wax::obj &key_, wax::obj &val){
return;
case MBOARD_PROP_RX_DBOARD_NAMES:
- val = prop_names_t(get_map_keys(_dboard_managers));
+ val = prop_names_t(_dboard_managers.get_keys());
return;
case MBOARD_PROP_TX_DBOARD:
- if (_dboard_managers.count(name) == 0) throw std::invalid_argument(
+ if (not _dboard_managers.has_key(name)) throw std::invalid_argument(
str(boost::format("Unknown tx dboard name %s") % name)
);
//FIXME store the shell dboard within the class
@@ -165,7 +164,7 @@ void test::get(const wax::obj &key_, wax::obj &val){
return;
case MBOARD_PROP_TX_DBOARD_NAMES:
- val = prop_names_t(get_map_keys(_dboard_managers));
+ val = prop_names_t(_dboard_managers.get_keys());
return;
case MBOARD_PROP_MTU:
diff --git a/lib/usrp/usrp.cpp b/lib/usrp/usrp.cpp
index 68b423538..86a40ebd8 100644
--- a/lib/usrp/usrp.cpp
+++ b/lib/usrp/usrp.cpp
@@ -18,7 +18,6 @@
#include <uhd/usrp/usrp.hpp>
#include <uhd/usrp/mboard/usrp2.hpp>
#include <uhd/usrp/mboard/test.hpp>
-#include <uhd/utils.hpp>
#include <boost/format.hpp>
#include <boost/bind.hpp>
#include <stdexcept>
@@ -72,7 +71,7 @@ void usrp::get(const wax::obj &key_, wax::obj &val){
return;
case DEVICE_PROP_MBOARD:
- if (_mboards.count(name) == 0) throw std::invalid_argument(
+ if (not _mboards.has_key(name)) throw std::invalid_argument(
str(boost::format("Unknown mboard name %s") % name)
);
//turn the mboard sptr object into a wax::obj::sptr
@@ -81,7 +80,7 @@ void usrp::get(const wax::obj &key_, wax::obj &val){
return;
case DEVICE_PROP_MBOARD_NAMES:
- val = prop_names_t(get_map_keys(_mboards));
+ val = prop_names_t(_mboards.get_keys());
return;
}
}