root / gr-uhd / swig / uhd_swig.i @ 81d3460c
History | View | Annotate | Download (3.7 kB)
| 1 | /* -*- c++ -*- */ |
|---|---|
| 2 | /* |
| 3 | * Copyright 2010-2011 Free Software Foundation, Inc. |
| 4 | * |
| 5 | * This file is part of GNU Radio |
| 6 | * |
| 7 | * GNU Radio is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3, or (at your option) |
| 10 | * any later version. |
| 11 | * |
| 12 | * GNU Radio is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with GNU Radio; see the file COPYING. If not, write to |
| 19 | * the Free Software Foundation, Inc., 51 Franklin Street, |
| 20 | * Boston, MA 02110-1301, USA. |
| 21 | */ |
| 22 | |
| 23 | // Defined during configure; avoids trying to locate |
| 24 | // header files if UHD was not installed. |
| 25 | #ifdef GR_HAVE_UHD |
| 26 | |
| 27 | #define GR_UHD_API |
| 28 | |
| 29 | //////////////////////////////////////////////////////////////////////// |
| 30 | // Language independent exception handler |
| 31 | //////////////////////////////////////////////////////////////////////// |
| 32 | %include exception.i |
| 33 | |
| 34 | %exception {
|
| 35 | try {
|
| 36 | $action |
| 37 | } |
| 38 | catch(std::exception &e) {
|
| 39 | SWIG_exception(SWIG_RuntimeError, e.what()); |
| 40 | } |
| 41 | catch(...) {
|
| 42 | SWIG_exception(SWIG_RuntimeError, "Unknown exception"); |
| 43 | } |
| 44 | |
| 45 | } |
| 46 | |
| 47 | //////////////////////////////////////////////////////////////////////// |
| 48 | // standard includes |
| 49 | //////////////////////////////////////////////////////////////////////// |
| 50 | %include "gnuradio.i" |
| 51 | |
| 52 | //////////////////////////////////////////////////////////////////////// |
| 53 | // block headers |
| 54 | //////////////////////////////////////////////////////////////////////// |
| 55 | %{
|
| 56 | #include <uhd_multi_usrp_source.h> |
| 57 | #include <uhd_multi_usrp_sink.h> |
| 58 | #include <uhd_single_usrp_source.h> |
| 59 | #include <uhd_single_usrp_sink.h> |
| 60 | %} |
| 61 | |
| 62 | //////////////////////////////////////////////////////////////////////// |
| 63 | // used types |
| 64 | //////////////////////////////////////////////////////////////////////// |
| 65 | %template(string_vector_t) std::vector<std::string>; |
| 66 | |
| 67 | %include <uhd/config.hpp> |
| 68 | |
| 69 | %include <uhd/utils/pimpl.hpp> |
| 70 | |
| 71 | %include <uhd/types/dict.hpp> |
| 72 | %template(string_string_dict_t) uhd::dict<std::string, std::string>; //define after dict |
| 73 | |
| 74 | %include <uhd/types/device_addr.hpp> |
| 75 | |
| 76 | %include <uhd/types/io_type.hpp> |
| 77 | |
| 78 | %template(range_vector_t) std::vector<uhd::range_t>; //define before range |
| 79 | %include <uhd/types/ranges.hpp> |
| 80 | |
| 81 | %include <uhd/types/tune_request.hpp> |
| 82 | |
| 83 | %include <uhd/types/tune_result.hpp> |
| 84 | |
| 85 | %include <uhd/types/io_type.hpp> |
| 86 | |
| 87 | %include <uhd/types/time_spec.hpp> |
| 88 | |
| 89 | %include <uhd/types/clock_config.hpp> |
| 90 | |
| 91 | %include <uhd/types/metadata.hpp> |
| 92 | |
| 93 | %include <uhd/device.hpp> |
| 94 | %template(device_addr_vector_t) std::vector<uhd::device_addr_t>; |
| 95 | |
| 96 | //////////////////////////////////////////////////////////////////////// |
| 97 | // block magic |
| 98 | //////////////////////////////////////////////////////////////////////// |
| 99 | GR_SWIG_BLOCK_MAGIC(uhd,multi_usrp_source) |
| 100 | %include <uhd_multi_usrp_source.h> |
| 101 | |
| 102 | GR_SWIG_BLOCK_MAGIC(uhd,multi_usrp_sink) |
| 103 | %include <uhd_multi_usrp_sink.h> |
| 104 | |
| 105 | GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_source) |
| 106 | %include <uhd_single_usrp_source.h> |
| 107 | |
| 108 | GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_sink) |
| 109 | %include <uhd_single_usrp_sink.h> |
| 110 | |
| 111 | //////////////////////////////////////////////////////////////////////// |
| 112 | // helpful constants |
| 113 | //////////////////////////////////////////////////////////////////////// |
| 114 | %{
|
| 115 | static const size_t ALL_MBOARDS = uhd::usrp::multi_usrp::ALL_MBOARDS; |
| 116 | %} |
| 117 | static const size_t ALL_MBOARDS; |
| 118 | |
| 119 | #if SWIGGUILE |
| 120 | %scheme %{
|
| 121 | (load-extension-global "libguile-gnuradio-uhd_swig" "scm_init_gnuradio_uhd_swig_module") |
| 122 | %} |
| 123 | |
| 124 | %goops %{
|
| 125 | (use-modules (gnuradio gnuradio_core_runtime)) |
| 126 | %} |
| 127 | #endif /* SWIGGUILE */ |
| 128 | |
| 129 | #endif /* GR_HAVE_UHD */ |