diff options
-rw-r--r-- | gr-uhd/swig/__init__.py | 21 | ||||
-rw-r--r-- | gr-uhd/swig/uhd_swig.i | 5 |
2 files changed, 16 insertions, 10 deletions
diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 18b5dfefc..1a9f8358d 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -22,6 +22,17 @@ # The presence of this file turns this directory into a Python package ######################################################################## +# Create aliases for uhd swig attributes to avoid the "_t" +# Install the __str__ and __repr__ handlers if applicable +######################################################################## +import uhd_swig +for attr in dir(uhd_swig): + myobj = getattr(uhd_swig, attr) + if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda s: s.to_string().strip() + if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda s: s.to_pp_string().strip() + if attr.endswith('_t'): setattr(uhd_swig, attr[:-2], myobj) + +######################################################################## # Add SWIG generated code to this namespace ######################################################################## from uhd_swig import * @@ -53,16 +64,6 @@ class device_addr_t(device_addr_t, str): def __setitem__(self, key, val): self.set(key, val) ######################################################################## -# Create aliases for global attributes to avoid the "_t" -# Install the __str__ and __repr__ handlers if applicable -######################################################################## -for attr in globals().keys(): - myobj = globals()[attr] - if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda s: s.to_string().strip() - if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda s: s.to_pp_string().strip() - if attr.endswith('_t'): globals()[attr[:-2]] = myobj - -######################################################################## # Cast constructor args (FIXME swig handle overloads?) ######################################################################## for attr in ( diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index e25dbce90..3c317beb4 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -88,6 +88,11 @@ %include <uhd/types/clock_config.hpp> +%include <uhd/types/metadata.hpp> + +%include <uhd/device.hpp> +%template(device_addr_vector_t) std::vector<uhd::device_addr_t>; + //////////////////////////////////////////////////////////////////////// // block magic //////////////////////////////////////////////////////////////////////// |