summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-10-03 16:46:00 -0700
committerJosh Blum <josh@joshknows.com>2011-11-03 20:37:10 -0700
commit75b7967fac3ec72fb35c542da23491215d53a8bb (patch)
treefa588c1e71bb7cbc751d2f5738bb37aad5cfec45 /host/include
parentc480414fea7948dedd9428f545dfff90f4c8f2c8 (diff)
downloaduhd-75b7967fac3ec72fb35c542da23491215d53a8bb.tar.gz
uhd-75b7967fac3ec72fb35c542da23491215d53a8bb.tar.bz2
uhd-75b7967fac3ec72fb35c542da23491215d53a8bb.zip
convert: reworked convert to use new identification standard
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/convert.hpp59
1 files changed, 32 insertions, 27 deletions
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 <uhd/config.hpp>
-#include <uhd/types/io_type.hpp>
-#include <uhd/types/otw_type.hpp>
#include <uhd/types/ref_vector.hpp>
#include <boost/function.hpp>
+#include <boost/operators.hpp>
#include <string>
namespace uhd{ namespace convert{
typedef uhd::ref_vector<void *> output_type;
typedef uhd::ref_vector<const void *> input_type;
- typedef boost::function<void(const input_type&, const output_type&, size_t, double)> function_type;
+
+ //! input vectors, output vectors, num samples, scale factor
+ typedef boost::function<void(const input_type&, const output_type&, const size_t, const double)> 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<id_type>{
+ 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 */