Revision 52e20f9e host/include/uhd/convert.hpp

b/host/include/uhd/convert.hpp
19 19
#define INCLUDED_UHD_CONVERT_HPP
20 20

  
21 21
#include <uhd/config.hpp>
22
#include <uhd/types/io_type.hpp>
23
#include <uhd/types/otw_type.hpp>
24 22
#include <uhd/types/ref_vector.hpp>
25 23
#include <boost/function.hpp>
24
#include <boost/operators.hpp>
26 25
#include <string>
27 26

  
28 27
namespace uhd{ namespace convert{
29 28

  
30 29
    typedef uhd::ref_vector<void *> output_type;
31 30
    typedef uhd::ref_vector<const void *> input_type;
32
    typedef boost::function<void(const input_type&, const output_type&, size_t, double)> function_type;
31

  
32
    //! input vectors, output vectors, num samples, scale factor
33
    typedef boost::function<void(const input_type&, const output_type&, const size_t, const double)> function_type;
33 34

  
34 35
    /*!
35 36
     * Describe the priority of a converter function.
......
45 46
        PRIORITY_EMPTY = -1,
46 47
    };
47 48

  
49
    //! Identify a conversion routine in the registry
50
    struct id_type : boost::equality_comparable<id_type>{
51
        std::string input_markup;
52
        size_t num_inputs;
53
        std::string output_markup;
54
        size_t num_outputs;
55
        std::string args;
56
        std::string to_pp_string(void) const;
57
    };
58

  
59
    //! Implement equality_comparable interface
60
    UHD_API bool operator==(const id_type &, const id_type &);
61

  
48 62
    /*!
49
     * Register a converter function that converts cpu type to/from otw type.
50
     * \param markup representing the signature
63
     * Register a converter function.
64
     * \param id identify the conversion
51 65
     * \param fcn a pointer to the converter
52 66
     * \param prio the function priority
53 67
     */
54 68
    UHD_API void register_converter(
55
        const std::string &markup,
69
        const id_type &id,
56 70
        function_type fcn,
57 71
        priority_type prio
58 72
    );
59 73

  
60 74
    /*!
61
     * Get a converter function that converts cpu to otw.
62
     * \param io_type the type of the input samples
63
     * \param otw_type the type of the output samples
64
     * \param num_input_buffs the number of inputs
65
     * \param num_output_buffs the number of outputs
75
     * Get a converter function.
76
     * \param id identify the conversion
77
     * \return the converter function
66 78
     */
67
    UHD_API const function_type &get_converter_cpu_to_otw(
68
        const io_type_t &io_type,
69
        const otw_type_t &otw_type,
70
        size_t num_input_buffs,
71
        size_t num_output_buffs
72
    );
79
    UHD_API function_type get_converter(const id_type &id);
73 80

  
74 81
    /*!
75
     * Get a converter function that converts otw to cpu.
76
     * \param io_type the type of the input samples
77
     * \param otw_type the type of the output samples
78
     * \param num_input_buffs the number of inputs
79
     * \param num_output_buffs the number of outputs
82
     * Register the size of a particular item.
83
     * \param markup the item markup
84
     * \param size the size in bytes
80 85
     */
81
    UHD_API const function_type &get_converter_otw_to_cpu(
82
        const io_type_t &io_type,
83
        const otw_type_t &otw_type,
84
        size_t num_input_buffs,
85
        size_t num_output_buffs
86
    UHD_API void register_bytes_per_item(
87
        const std::string &markup, const size_t size
86 88
    );
87 89

  
90
    //! Convert an item markup to a size in bytes
91
    UHD_API size_t get_bytes_per_item(const std::string &markup);
92

  
88 93
}} //namespace
89 94

  
90 95
#endif /* INCLUDED_UHD_CONVERT_HPP */

Also available in: Unified diff