diff options
author | Josh Blum <josh@joshknows.com> | 2010-01-15 15:45:33 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-01-15 15:45:33 -0800 |
commit | 92c76e574773e99d1bfb5c3a833217b8644779f4 (patch) | |
tree | 12c80f9acf1c9ac489eddaedb13861e0ab9674b0 /include/usrp_uhd | |
parent | 3b47904f24169904bf65b29091d85ddfc2a7edb4 (diff) | |
download | uhd-92c76e574773e99d1bfb5c3a833217b8644779f4.tar.gz uhd-92c76e574773e99d1bfb5c3a833217b8644779f4.tar.bz2 uhd-92c76e574773e99d1bfb5c3a833217b8644779f4.zip |
Dboard base class that is no longer also the xcvr.
The xcvr base inherits from this (as does rx and tx base).
Added m4 macro to check for compiler flags.
The configure checks flags and headers.
Merged the register subdev static methods into one method
that associates a dboard id with a dboard constructor.
The manager code is responsible for checking this association
and creating the correct subdev instances.
Diffstat (limited to 'include/usrp_uhd')
-rw-r--r-- | include/usrp_uhd/usrp/dboard/base.hpp | 27 | ||||
-rw-r--r-- | include/usrp_uhd/usrp/dboard/manager.hpp | 28 |
2 files changed, 27 insertions, 28 deletions
diff --git a/include/usrp_uhd/usrp/dboard/base.hpp b/include/usrp_uhd/usrp/dboard/base.hpp index 09cc9b324..82895ed59 100644 --- a/include/usrp_uhd/usrp/dboard/base.hpp +++ b/include/usrp_uhd/usrp/dboard/base.hpp @@ -15,19 +15,19 @@ namespace usrp_uhd{ namespace usrp{ namespace dboard{ /*! * A daughter board base class for all dboards. - * Sub classes for xcvr boards should inherit this. + * Only other dboard base classes should inherit this. */ -class xcvr_base : boost::noncopyable{ +class base : boost::noncopyable{ public: - typedef boost::shared_ptr<xcvr_base> sptr; + typedef boost::shared_ptr<base> sptr; //the constructor args consist of a subdev index and an interface //derived classes should pass the args into the base class ctor //but should not have to deal with the internals of the args typedef boost::tuple<size_t, interface::sptr> ctor_args_t; //structors - xcvr_base(ctor_args_t const&); - ~xcvr_base(void); + base(ctor_args_t const&); + ~base(void); //interface virtual void rx_get(const wax::type &key, wax::type &val) = 0; @@ -45,10 +45,23 @@ private: }; /*! + * A xcvr daughter board implements rx and tx methods + * Sub classes for xcvr boards should inherit this. + */ +class xcvr_base : public base{ +public: + /*! + * Create a new xcvr dboard object, override in subclasses. + */ + xcvr_base(ctor_args_t const&); + ~xcvr_base(void); +}; + +/*! * A rx daughter board only implements rx methods. * Sub classes for rx-only boards should inherit this. */ -class rx_base : public xcvr_base{ +class rx_base : public base{ public: /*! * Create a new rx dboard object, override in subclasses. @@ -66,7 +79,7 @@ public: * A tx daughter board only implements tx methods. * Sub classes for rx-only boards should inherit this. */ -class tx_base : public xcvr_base{ +class tx_base : public base{ public: /*! * Create a new rx dboard object, override in subclasses. diff --git a/include/usrp_uhd/usrp/dboard/manager.hpp b/include/usrp_uhd/usrp/dboard/manager.hpp index 788b8a6eb..d977fa527 100644 --- a/include/usrp_uhd/usrp/dboard/manager.hpp +++ b/include/usrp_uhd/usrp/dboard/manager.hpp @@ -8,7 +8,6 @@ #include <vector> #include <usrp_uhd/wax.hpp> #include <boost/utility.hpp> -#include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <usrp_uhd/usrp/dboard/base.hpp> @@ -26,29 +25,16 @@ public: typedef uint16_t dboard_id_t; //dboard constructor (each dboard should have a ::make with this signature) - typedef boost::function<xcvr_base::sptr(xcvr_base::ctor_args_t)> dboard_ctor_t; + typedef base::sptr(*dboard_ctor_t)(base::ctor_args_t const&); /*! - * Register rx subdevices for a given dboard id. + * Register subdevices for a given dboard id. * - * \param dboard_id the rx dboard id + * \param dboard_id the dboard id (rx or tx) * \param dboard_ctor the dboard constructor function pointer - * \param num_subdevs the number of rx subdevs in this dboard + * \param num_subdevs the number of subdevs in this dboard */ - static void register_rx_subdev( - dboard_id_t dboard_id, - dboard_ctor_t dboard_ctor, - size_t num_subdevs - ); - - /*! - * Register tx subdevices for a given dboard id. - * - * \param dboard_id the tx dboard id - * \param dboard_ctor the dboard constructor function pointer - * \param num_subdevs the number of tx subdevs in this dboard - */ - static void register_tx_subdev( + static void register_subdevs( dboard_id_t dboard_id, dboard_ctor_t dboard_ctor, size_t num_subdevs @@ -73,8 +59,8 @@ public: private: //list of rx and tx dboards in this manager //each dboard here is actually a subdevice - std::vector<xcvr_base::sptr> _rx_dboards; - std::vector<xcvr_base::sptr> _tx_dboards; + std::vector<base::sptr> _rx_dboards; + std::vector<base::sptr> _tx_dboards; }; }}} //namespace |