aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard_base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/dboard_base.cpp')
-rw-r--r--host/lib/usrp/dboard_base.cpp42
1 files changed, 24 insertions, 18 deletions
diff --git a/host/lib/usrp/dboard_base.cpp b/host/lib/usrp/dboard_base.cpp
index 68e4743d1..bd4b37ef3 100644
--- a/host/lib/usrp/dboard_base.cpp
+++ b/host/lib/usrp/dboard_base.cpp
@@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
+#include "dboard_ctor_args.hpp"
#include <uhd/usrp/dboard_base.hpp>
#include <boost/format.hpp>
#include <stdexcept>
@@ -24,43 +25,48 @@ using namespace uhd::usrp;
/***********************************************************************
* dboard_base dboard dboard_base class
**********************************************************************/
-dboard_base::dboard_base(ctor_args_t const& args){
- boost::tie(_subdev_name, _dboard_iface, _rx_id, _tx_id) = args;
+struct dboard_base::dboard_base_impl{
+ ctor_args_impl args;
+ dboard_base_impl(ctor_args_t args) : args(*args){}
+};
+
+dboard_base::dboard_base(ctor_args_t args){
+ _impl = new dboard_base_impl(args);
}
dboard_base::~dboard_base(void){
- /* NOP */
+ delete _impl;
}
std::string dboard_base::get_subdev_name(void){
- return _subdev_name;
+ return _impl->args.sd_name;
}
dboard_iface::sptr dboard_base::get_iface(void){
- return _dboard_iface;
+ return _impl->args.db_iface;
}
dboard_id_t dboard_base::get_rx_id(void){
- return _rx_id;
+ return _impl->args.rx_id;
}
dboard_id_t dboard_base::get_tx_id(void){
- return _tx_id;
+ return _impl->args.tx_id;
}
/***********************************************************************
* xcvr dboard dboard_base class
**********************************************************************/
-xcvr_dboard_base::xcvr_dboard_base(ctor_args_t const& args) : dboard_base(args){
- if (get_rx_id() == dboard_id::NONE){
+xcvr_dboard_base::xcvr_dboard_base(ctor_args_t args) : dboard_base(args){
+ if (get_rx_id() == dboard_id_t::none()){
throw std::runtime_error(str(boost::format(
"cannot create xcvr board when the rx id is \"%s\""
- ) % dboard_id::to_string(dboard_id::NONE)));
+ ) % dboard_id_t::none().to_pp_string()));
}
- if (get_tx_id() == dboard_id::NONE){
+ if (get_tx_id() == dboard_id_t::none()){
throw std::runtime_error(str(boost::format(
"cannot create xcvr board when the tx id is \"%s\""
- ) % dboard_id::to_string(dboard_id::NONE)));
+ ) % dboard_id_t::none().to_pp_string()));
}
}
@@ -71,12 +77,12 @@ xcvr_dboard_base::~xcvr_dboard_base(void){
/***********************************************************************
* rx dboard dboard_base class
**********************************************************************/
-rx_dboard_base::rx_dboard_base(ctor_args_t const& args) : dboard_base(args){
- if (get_tx_id() != dboard_id::NONE){
+rx_dboard_base::rx_dboard_base(ctor_args_t args) : dboard_base(args){
+ if (get_tx_id() != dboard_id_t::none()){
throw std::runtime_error(str(boost::format(
"cannot create rx board when the tx id is \"%s\""
" -> expected a tx id of \"%s\""
- ) % dboard_id::to_string(get_tx_id()) % dboard_id::to_string(dboard_id::NONE)));
+ ) % get_tx_id().to_pp_string() % dboard_id_t::none().to_pp_string()));
}
}
@@ -95,12 +101,12 @@ void rx_dboard_base::tx_set(const wax::obj &, const wax::obj &){
/***********************************************************************
* tx dboard dboard_base class
**********************************************************************/
-tx_dboard_base::tx_dboard_base(ctor_args_t const& args) : dboard_base(args){
- if (get_rx_id() != dboard_id::NONE){
+tx_dboard_base::tx_dboard_base(ctor_args_t args) : dboard_base(args){
+ if (get_rx_id() != dboard_id_t::none()){
throw std::runtime_error(str(boost::format(
"cannot create tx board when the rx id is \"%s\""
" -> expected a rx id of \"%s\""
- ) % dboard_id::to_string(get_rx_id()) % dboard_id::to_string(dboard_id::NONE)));
+ ) % get_rx_id().to_pp_string() % dboard_id_t::none().to_pp_string()));
}
}