From 75b7967fac3ec72fb35c542da23491215d53a8bb Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 3 Oct 2011 16:46:00 -0700 Subject: convert: reworked convert to use new identification standard --- host/include/uhd/convert.hpp | 59 ++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 27 deletions(-) (limited to 'host/include') diff --git a/host/include/uhd/convert.hpp b/host/include/uhd/convert.hpp index 99f1860ae..a0b502ab0 100644 --- a/host/include/uhd/convert.hpp +++ b/host/include/uhd/convert.hpp @@ -19,17 +19,18 @@ #define INCLUDED_UHD_CONVERT_HPP #include -#include -#include #include #include +#include #include namespace uhd{ namespace convert{ typedef uhd::ref_vector output_type; typedef uhd::ref_vector input_type; - typedef boost::function function_type; + + //! input vectors, output vectors, num samples, scale factor + typedef boost::function function_type; /*! * Describe the priority of a converter function. @@ -45,46 +46,50 @@ namespace uhd{ namespace convert{ PRIORITY_EMPTY = -1, }; + //! Identify a conversion routine in the registry + struct id_type : boost::equality_comparable{ + std::string input_markup; + size_t num_inputs; + std::string output_markup; + size_t num_outputs; + std::string args; + std::string to_pp_string(void) const; + }; + + //! Implement equality_comparable interface + UHD_API bool operator==(const id_type &, const id_type &); + /*! - * Register a converter function that converts cpu type to/from otw type. - * \param markup representing the signature + * Register a converter function. + * \param id identify the conversion * \param fcn a pointer to the converter * \param prio the function priority */ UHD_API void register_converter( - const std::string &markup, + const id_type &id, function_type fcn, priority_type prio ); /*! - * Get a converter function that converts cpu to otw. - * \param io_type the type of the input samples - * \param otw_type the type of the output samples - * \param num_input_buffs the number of inputs - * \param num_output_buffs the number of outputs + * Get a converter function. + * \param id identify the conversion + * \return the converter function */ - UHD_API const function_type &get_converter_cpu_to_otw( - const io_type_t &io_type, - const otw_type_t &otw_type, - size_t num_input_buffs, - size_t num_output_buffs - ); + UHD_API function_type get_converter(const id_type &id); /*! - * Get a converter function that converts otw to cpu. - * \param io_type the type of the input samples - * \param otw_type the type of the output samples - * \param num_input_buffs the number of inputs - * \param num_output_buffs the number of outputs + * Register the size of a particular item. + * \param markup the item markup + * \param size the size in bytes */ - UHD_API const function_type &get_converter_otw_to_cpu( - const io_type_t &io_type, - const otw_type_t &otw_type, - size_t num_input_buffs, - size_t num_output_buffs + UHD_API void register_bytes_per_item( + const std::string &markup, const size_t size ); + //! Convert an item markup to a size in bytes + UHD_API size_t get_bytes_per_item(const std::string &markup); + }} //namespace #endif /* INCLUDED_UHD_CONVERT_HPP */ -- cgit v1.2.3