From 76a6f912706313fdc256b09aa17eeaf275e1fbc4 Mon Sep 17 00:00:00 2001 From: Tom Rondeau <trondeau@vt.edu> Date: Tue, 14 Aug 2012 22:28:47 -0400 Subject: swig: adds a macro to allow us to specify different factory functions besides 'make' for a block. digital: converted cpmmod to new style. gmskmod inherits directly from cpmmod with just preset args. Defining another factory function, make_gmks_bc, here to make this all handled internally. --- gnuradio-core/src/lib/swig/gr_swig_block_magic.i | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gnuradio-core/src/lib/swig') diff --git a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i index 4016ae7727..6d1af6136d 100644 --- a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i +++ b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i @@ -48,3 +48,11 @@ BASE_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), BASE_NAME = BASE_NAME.make; %} %enddef + +%define GR_SWIG_BLOCK_MAGIC_FACTORY(PKG, BASE_NAME, FACTORY) +%template(FACTORY ## _sptr) boost::shared_ptr<gr:: ## PKG ## :: ## BASE_NAME>; +%pythoncode %{ +FACTORY ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id()) +FACTORY = BASE_NAME ## _make_ ## FACTORY; +%} +%enddef -- cgit v1.2.3