diff options
author | Josh Blum | 2011-01-05 16:19:19 -0800 |
---|---|---|
committer | Josh Blum | 2011-01-19 22:24:57 -0800 |
commit | c63edcbe834c0929a7e0c7907f7c79ffc3fc5667 (patch) | |
tree | ee39390a15bfbb9a397d7e191f74c96c9a4d3ef1 /gr-uhd | |
parent | 5a671f0b925e0a4f57344225514147cc0dc4a5d8 (diff) | |
download | gnuradio-c63edcbe834c0929a7e0c7907f7c79ffc3fc5667.tar.gz gnuradio-c63edcbe834c0929a7e0c7907f7c79ffc3fc5667.tar.bz2 gnuradio-c63edcbe834c0929a7e0c7907f7c79ffc3fc5667.zip |
uhd: swig + python tweaks to uhd types
Diffstat (limited to 'gr-uhd')
-rw-r--r-- | gr-uhd/swig/__init__.py | 9 | ||||
-rw-r--r-- | gr-uhd/swig/uhd_swig.i | 12 |
2 files changed, 16 insertions, 5 deletions
diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 6d09f19f0..a8082bc34 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -30,7 +30,8 @@ from uhd_swig import * # Add other content from pure-Python modules here ######################################################################## -#make the meta-range printable in python +#make the ranges printable in python +range_t.__str__ = lambda s: s.to_pp_string().strip() meta_range_t.__str__ = lambda s: s.to_pp_string().strip() class freq_range_t(meta_range_t): pass #a typedef for the user @@ -44,3 +45,9 @@ class tune_request_t(tune_request_t, float): """ def __new__(self, *args): return float.__new__(self) def __float__(self): return self.target_freq + +######################################################################## +# Create aliases for global attributes to avoid the "_t" +######################################################################## +for attr in globals().keys(): + if attr.endswith('_t'): globals()[attr[:-2]] = globals()[attr] diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index cf4ecf920..5628a1203 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -24,6 +24,8 @@ // header files if UHD was not installed. #ifdef GR_HAVE_UHD +#define GR_UHD_API + //////////////////////////////////////////////////////////////////////// // Language independent exception handler //////////////////////////////////////////////////////////////////////// @@ -47,10 +49,6 @@ //////////////////////////////////////////////////////////////////////// %include "gnuradio.i" -namespace std { - %template(StringVector) vector<string>; -} - //////////////////////////////////////////////////////////////////////// // block headers //////////////////////////////////////////////////////////////////////// @@ -62,6 +60,12 @@ namespace std { %} //////////////////////////////////////////////////////////////////////// +// templated types +//////////////////////////////////////////////////////////////////////// +%template(string_vector_t) std::vector<std::string>; +%template(range_vector_t) std::vector<uhd::range_t>; + +//////////////////////////////////////////////////////////////////////// // used types //////////////////////////////////////////////////////////////////////// %include <uhd/config.hpp> |