From f1fe66acd4fd32fe0f99548f11e8f4ab28b4c9f1 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 22 Jul 2010 10:26:48 -0700 Subject: usrp: changed opaque pointer implementation for dboard contructor args --- host/include/uhd/usrp/dboard_base.hpp | 2 +- host/include/uhd/utils/pimpl.hpp | 3 ++- host/lib/usrp/dboard_base.cpp | 6 +++--- host/lib/usrp/dboard_ctor_args.hpp | 20 ++++++++++++-------- host/lib/usrp/dboard_manager.cpp | 2 +- 5 files changed, 19 insertions(+), 14 deletions(-) (limited to 'host') diff --git a/host/include/uhd/usrp/dboard_base.hpp b/host/include/uhd/usrp/dboard_base.hpp index e88d39876..9b75d791f 100644 --- a/host/include/uhd/usrp/dboard_base.hpp +++ b/host/include/uhd/usrp/dboard_base.hpp @@ -40,7 +40,7 @@ public: * Derived classes should pass the args into the base class, * but should not deal with the internals of the args. */ - struct ctor_args_impl; typedef ctor_args_impl* ctor_args_t; + typedef void * ctor_args_t; //structors dboard_base(ctor_args_t); diff --git a/host/include/uhd/utils/pimpl.hpp b/host/include/uhd/utils/pimpl.hpp index 09bf0c0a2..18454f0c4 100644 --- a/host/include/uhd/utils/pimpl.hpp +++ b/host/include/uhd/utils/pimpl.hpp @@ -20,6 +20,7 @@ #include #include +#include /*! \file pimpl.hpp * "Pimpl idiom" (pointer to implementation idiom). @@ -50,6 +51,6 @@ * \param _args the constructor args for the pimpl */ #define UHD_PIMPL_MAKE(_name, _args) \ - boost::shared_ptr<_name>(new _name _args) + boost::make_shared<_name> _args #endif /* INCLUDED_UHD_UTILS_PIMPL_HPP */ diff --git a/host/lib/usrp/dboard_base.cpp b/host/lib/usrp/dboard_base.cpp index eafb8897f..6c4e29d9e 100644 --- a/host/lib/usrp/dboard_base.cpp +++ b/host/lib/usrp/dboard_base.cpp @@ -26,12 +26,12 @@ using namespace uhd::usrp; * dboard_base dboard dboard_base class **********************************************************************/ struct dboard_base::impl{ - ctor_args_impl args; - impl(ctor_args_t args) : args(*args){} + dboard_ctor_args_t args; }; dboard_base::dboard_base(ctor_args_t args){ - _impl = UHD_PIMPL_MAKE(impl, (args)); + _impl = UHD_PIMPL_MAKE(impl, ()); + _impl->args = *static_cast(args); } dboard_base::~dboard_base(void){ diff --git a/host/lib/usrp/dboard_ctor_args.hpp b/host/lib/usrp/dboard_ctor_args.hpp index 13abe79e8..708f2ea08 100644 --- a/host/lib/usrp/dboard_ctor_args.hpp +++ b/host/lib/usrp/dboard_ctor_args.hpp @@ -15,18 +15,22 @@ // along with this program. If not, see . // -#ifndef INCLUDED_DBOARD_CTOR_ARGS_HPP -#define INCLUDED_DBOARD_CTOR_ARGS_HPP +#ifndef INCLUDED_LIBUHD_USRP_DBOARD_CTOR_ARGS_HPP +#define INCLUDED_LIBUHD_USRP_DBOARD_CTOR_ARGS_HPP #include #include #include #include -struct uhd::usrp::dboard_base::ctor_args_impl{ - std::string sd_name; - dboard_iface::sptr db_iface; - dboard_id_t rx_id, tx_id; -}; +namespace uhd{ namespace usrp{ -#endif /* INCLUDED_DBOARD_CTOR_ARGS_HPP */ + struct dboard_ctor_args_t{ + std::string sd_name; + dboard_iface::sptr db_iface; + dboard_id_t rx_id, tx_id; + }; + +}} //namespace + +#endif /* INCLUDED_LIBUHD_USRP_DBOARD_CTOR_ARGS_HPP */ diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp index 6321e018f..bfaaf0969 100644 --- a/host/lib/usrp/dboard_manager.cpp +++ b/host/lib/usrp/dboard_manager.cpp @@ -242,7 +242,7 @@ dboard_manager_impl::dboard_manager_impl( set_nice_dboard_if(); //dboard constructor args - dboard_base::ctor_args_impl db_ctor_args; + dboard_ctor_args_t db_ctor_args; db_ctor_args.db_iface = iface; //make xcvr subdevs (make one subdev for both rx and tx dboards) -- cgit v1.2.3