From 9789365e056ccf1373a59f0e63f6f94f83f5073f Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 20 Oct 2011 22:38:57 -0700 Subject: tags: added swigging for gr_tags header --- gnuradio-core/src/lib/runtime/CMakeLists.txt | 1 + gnuradio-core/src/lib/runtime/Makefile.am | 1 + gnuradio-core/src/lib/runtime/gr_tags.h | 11 +++------- gnuradio-core/src/lib/runtime/gr_tags.i | 32 ++++++++++++++++++++++++++++ gnuradio-core/src/lib/runtime/runtime.i | 3 +++ gnuradio-core/src/lib/swig/CMakeLists.txt | 2 +- 6 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 gnuradio-core/src/lib/runtime/gr_tags.i (limited to 'gnuradio-core/src/lib') diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt index e0774154e..105fc0e06 100644 --- a/gnuradio-core/src/lib/runtime/CMakeLists.txt +++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt @@ -153,6 +153,7 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_block.i ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_decimator.i ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_interpolator.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_tags.i ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block.i ${CMAKE_CURRENT_SOURCE_DIR}/runtime.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am index d4233e1ba..38da3d5fd 100644 --- a/gnuradio-core/src/lib/runtime/Makefile.am +++ b/gnuradio-core/src/lib/runtime/Makefile.am @@ -160,5 +160,6 @@ swiginclude_HEADERS = \ gr_sync_block.i \ gr_sync_decimator.i \ gr_sync_interpolator.i \ + gr_tags.i \ gr_top_block.i \ runtime.i diff --git a/gnuradio-core/src/lib/runtime/gr_tags.h b/gnuradio-core/src/lib/runtime/gr_tags.h index e410e76a4..5fff6f15b 100644 --- a/gnuradio-core/src/lib/runtime/gr_tags.h +++ b/gnuradio-core/src/lib/runtime/gr_tags.h @@ -25,24 +25,19 @@ #include #include -//dummy namespace so the line below makes swig happy -namespace pmt{} -//stupid using namespace because pmt::pmt_t confuses swig -using namespace pmt; - struct GR_CORE_API gr_tag_t{ //! the item \p tag occurred at (as a uint64_t) uint64_t offset; //! the key of \p tag (as a PMT symbol) - pmt_t key; + pmt::pmt_t key; //! the value of \p tag (as a PMT) - pmt_t value; + pmt::pmt_t value; //! the source ID of \p tag (as a PMT) - pmt_t srcid; + pmt::pmt_t srcid; //! Comparison function to test which tag, \p x or \p y, came first in time static inline bool offset_compare( diff --git a/gnuradio-core/src/lib/runtime/gr_tags.i b/gnuradio-core/src/lib/runtime/gr_tags.i new file mode 100644 index 000000000..828d0147c --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_tags.i @@ -0,0 +1,32 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%{ +#include +%} + +%include //for pmt support + +%include + +//gives support for a vector of tags (get tags in range) +%include "std_vector.i" +%template(tags_vector_t) std::vector; diff --git a/gnuradio-core/src/lib/runtime/runtime.i b/gnuradio-core/src/lib/runtime/runtime.i index ca89b8fbd..e08693a0c 100644 --- a/gnuradio-core/src/lib/runtime/runtime.i +++ b/gnuradio-core/src/lib/runtime/runtime.i @@ -20,6 +20,8 @@ * Boston, MA 02110-1301, USA. */ +#define GR_CORE_API + %{ #include #include @@ -64,4 +66,5 @@ %include %include %include +%include %include diff --git a/gnuradio-core/src/lib/swig/CMakeLists.txt b/gnuradio-core/src/lib/swig/CMakeLists.txt index 73a6f92ff..b10b7c186 100644 --- a/gnuradio-core/src/lib/swig/CMakeLists.txt +++ b/gnuradio-core/src/lib/swig/CMakeLists.txt @@ -28,7 +28,7 @@ set(GR_SWIG_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS} ${GRUEL_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ) set(GR_SWIG_LIBRARIES gnuradio-core) -- cgit