diff options
author | Josh Blum | 2012-11-09 00:41:10 -0800 |
---|---|---|
committer | Josh Blum | 2012-11-09 00:41:10 -0800 |
commit | 74142393b1161fbf0af2531e6346846cc5fcb241 (patch) | |
tree | 99a6fe48fd514674a73255fed9062d1dfcd27001 /python/gras/GRAS_Block.i | |
parent | cb7b2b751220f2444c6187b7d6bf862b4cd56b37 (diff) | |
download | sandhi-74142393b1161fbf0af2531e6346846cc5fcb241.tar.gz sandhi-74142393b1161fbf0af2531e6346846cc5fcb241.tar.bz2 sandhi-74142393b1161fbf0af2531e6346846cc5fcb241.zip |
working on tags python support
Diffstat (limited to 'python/gras/GRAS_Block.i')
-rw-r--r-- | python/gras/GRAS_Block.i | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/python/gras/GRAS_Block.i b/python/gras/GRAS_Block.i index 9503af8..54f2186 100644 --- a/python/gras/GRAS_Block.i +++ b/python/gras/GRAS_Block.i @@ -14,8 +14,6 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#define GRAS_API - //////////////////////////////////////////////////////////////////////// // SWIG director shit - be explicit with all virtual methods //////////////////////////////////////////////////////////////////////// @@ -29,7 +27,6 @@ %feature("nodirector") gras::BlockPython::notify_topology; %feature("nodirector") gras::BlockPython::work; - //////////////////////////////////////////////////////////////////////// // http://www.swig.org/Doc2.0/Library.html#Library_stl_exceptions //////////////////////////////////////////////////////////////////////// @@ -95,6 +92,7 @@ struct PyGILPhondler //////////////////////////////////////////////////////////////////////// // Pull in the implementation goodies //////////////////////////////////////////////////////////////////////// +%include <gras/gras.hpp> %include <gras/element.i> %include <gras/io_signature.i> %include <gras/sbuffer.hpp> @@ -225,6 +223,15 @@ def sig_to_dtype_sig(sig): if sig is None: sig = () return map(numpy.dtype, sig) +Tag__ = Tag + +class Tag(object): + def __init__(self, offset=0, key=None, value=None, srcid=None): + self.offset = offset + self.key = key + self.value = value + self.srcid = srcid + class Block(BlockPython): def __init__(self, name='Block', in_sig=None, out_sig=None): BlockPython.__init__(self, name) @@ -288,4 +295,13 @@ class Block(BlockPython): def stop(self): return True + def post_output_tag(self, which_output, tag): + t = Tag__( + tag.offset, + Py2PMC(tag.key), + Py2PMC(tag.value), + Py2PMC(tag.srcid), + ) + BlockPython.post_output_tag(self, which_output, t) + %} |