root / gnuradio-core / src / lib / swig / gr_swig_block_magic.i @ 00ba4204
History | View | Annotate | Download (1.7 kB)
| 1 | 5d69a524 | jcorgan | /* -*- c++ -*- */ |
|---|---|---|---|
| 2 | 5d69a524 | jcorgan | /* |
| 3 | 5d69a524 | jcorgan | * Copyright 2004 Free Software Foundation, Inc. |
| 4 | 5d69a524 | jcorgan | * |
| 5 | 5d69a524 | jcorgan | * This file is part of GNU Radio |
| 6 | 5d69a524 | jcorgan | * |
| 7 | 5d69a524 | jcorgan | * GNU Radio is free software; you can redistribute it and/or modify |
| 8 | 5d69a524 | jcorgan | * it under the terms of the GNU General Public License as published by |
| 9 | 937b719d | eb | * the Free Software Foundation; either version 3, or (at your option) |
| 10 | 5d69a524 | jcorgan | * any later version. |
| 11 | 5d69a524 | jcorgan | * |
| 12 | 5d69a524 | jcorgan | * GNU Radio is distributed in the hope that it will be useful, |
| 13 | 5d69a524 | jcorgan | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | 5d69a524 | jcorgan | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | 5d69a524 | jcorgan | * GNU General Public License for more details. |
| 16 | 5d69a524 | jcorgan | * |
| 17 | 5d69a524 | jcorgan | * You should have received a copy of the GNU General Public License |
| 18 | 5d69a524 | jcorgan | * along with GNU Radio; see the file COPYING. If not, write to |
| 19 | 86f5c924 | eb | * the Free Software Foundation, Inc., 51 Franklin Street, |
| 20 | 86f5c924 | eb | * Boston, MA 02110-1301, USA. |
| 21 | 5d69a524 | jcorgan | */ |
| 22 | 5d69a524 | jcorgan | |
| 23 | 5d69a524 | jcorgan | %define GR_SWIG_BLOCK_MAGIC(PKG, BASE_NAME) |
| 24 | 5d69a524 | jcorgan | _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, PKG ## _ ## BASE_NAME, BASE_NAME) |
| 25 | 5d69a524 | jcorgan | %enddef |
| 26 | 5d69a524 | jcorgan | |
| 27 | 00ba4204 | Eric Blossom | %define _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME) |
| 28 | 5d69a524 | jcorgan | class NAME; |
| 29 | 5d69a524 | jcorgan | typedef boost::shared_ptr<NAME> NAME ## _sptr; |
| 30 | 5d69a524 | jcorgan | %template(NAME ## _sptr) boost::shared_ptr<NAME>; |
| 31 | 5d69a524 | jcorgan | %rename(BASE_NAME) PKG ## _make_ ## BASE_NAME; |
| 32 | 00ba4204 | Eric Blossom | %ignore NAME; |
| 33 | 00ba4204 | Eric Blossom | %enddef |
| 34 | 5d69a524 | jcorgan | |
| 35 | 1caa7d70 | Rob Savoye | #ifdef SWIGPYTHON |
| 36 | 00ba4204 | Eric Blossom | %define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, NAME, BASE_NAME) |
| 37 | 00ba4204 | Eric Blossom | _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME) |
| 38 | 5d69a524 | jcorgan | %pythoncode %{
|
| 39 | 5d69a524 | jcorgan | NAME ## _sptr.block = lambda self: NAME ## _block (self) |
| 40 | 5d69a524 | jcorgan | NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id ()) |
| 41 | 5d69a524 | jcorgan | %} |
| 42 | 5d69a524 | jcorgan | %enddef |
| 43 | 00ba4204 | Eric Blossom | #endif |
| 44 | 1caa7d70 | Rob Savoye | |
| 45 | 1caa7d70 | Rob Savoye | #ifdef SWIGGUILE |
| 46 | 00ba4204 | Eric Blossom | %define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, NAME, BASE_NAME) |
| 47 | 00ba4204 | Eric Blossom | _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME) |
| 48 | 54bfe428 | Rob Savoye | #warning "gr_block_sptr needs to be implemented!" |
| 49 | 00ba4204 | Eric Blossom | %enddef |
| 50 | 1caa7d70 | Rob Savoye | #endif |