diff options
author | Josh Blum | 2012-11-12 22:06:14 -0800 |
---|---|---|
committer | Josh Blum | 2012-11-12 22:06:14 -0800 |
commit | e6c5ccd5190917adcb3518add8a2dc7599bd86f1 (patch) | |
tree | d021bd2c023acad28b1ebc0cc454783b987987c6 /python | |
parent | c36e02443021ebda80cf9351d6065fcb892c4f82 (diff) | |
download | sandhi-e6c5ccd5190917adcb3518add8a2dc7599bd86f1.tar.gz sandhi-e6c5ccd5190917adcb3518add8a2dc7599bd86f1.tar.bz2 sandhi-e6c5ccd5190917adcb3518add8a2dc7599bd86f1.zip |
simplified the tags iterator stuff
Diffstat (limited to 'python')
-rw-r--r-- | python/gras/GRAS_Block.i | 58 |
1 files changed, 1 insertions, 57 deletions
diff --git a/python/gras/GRAS_Block.i b/python/gras/GRAS_Block.i index ddb5811..718829f 100644 --- a/python/gras/GRAS_Block.i +++ b/python/gras/GRAS_Block.i @@ -83,58 +83,8 @@ struct PyGILPhondler %include <gras/element.i> %include <gras/io_signature.i> %include <gras/sbuffer.hpp> -%include <gras/tags.hpp> +%include <gras/tags.i> %include <gras/block.hpp> -%include <PMC/PMC.i> - -//////////////////////////////////////////////////////////////////////// -// Create a python iterator class -//////////////////////////////////////////////////////////////////////// -%typemap(throws) Stop_Iteration -%{ - PyErr_SetNone(PyExc_StopIteration); - SWIG_fail; -%} - -%extend gras::TagIterPython -{ -%insert("python") -%{ - def __iter__(self): return self -%} -} - -%inline %{ - -struct Stop_Iteration -{ - Stop_Iteration(void){} -}; - -namespace gras -{ - -struct TagIterPython -{ - TagIterPython(const TagIter &iter): - _iter(iter), _it(iter.begin()) - { - //NOP - } - - const Tag &next(void) throw (Stop_Iteration) - { - if (_it == _iter.end()) throw Stop_Iteration(); - return *(_it++); - } - - TagIter _iter; - TagIter::const_iterator _it; -}; - -} - -%} //////////////////////////////////////////////////////////////////////// // Make a special block with safe overloads @@ -220,12 +170,6 @@ struct BlockPython : Block const std::vector<void *> &, const std::vector<size_t> & ) = 0; - - TagIterPython get_input_tags(const size_t which_input) - { - const TagIter it = Block::get_input_tags(which_input); - return TagIterPython(it); - } }; } |