From 9789365e056ccf1373a59f0e63f6f94f83f5073f Mon Sep 17 00:00:00 2001
From: Josh Blum <josh@joshknows.com>
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 +++
 5 files changed, 40 insertions(+), 8 deletions(-)
 create mode 100644 gnuradio-core/src/lib/runtime/gr_tags.i

(limited to 'gnuradio-core/src/lib/runtime')

diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt
index e0774154e1..105fc0e06f 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 d4233e1ba7..38da3d5fd5 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 e410e76a41..5fff6f15bd 100644
--- a/gnuradio-core/src/lib/runtime/gr_tags.h
+++ b/gnuradio-core/src/lib/runtime/gr_tags.h
@@ -25,24 +25,19 @@
 #include <gr_core_api.h>
 #include <gruel/pmt.h>
 
-//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 0000000000..828d0147ce
--- /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 <gr_tags.h>
+%}
+
+%include <pmt_swig.i> //for pmt support
+
+%include <gr_tags.h>
+
+//gives support for a vector of tags (get tags in range)
+%include "std_vector.i"
+%template(tags_vector_t) std::vector<gr_tag_t>;
diff --git a/gnuradio-core/src/lib/runtime/runtime.i b/gnuradio-core/src/lib/runtime/runtime.i
index ca89b8fbde..e08693a0cb 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 <gr_runtime_types.h>
 #include <gr_io_signature.h>
@@ -64,4 +66,5 @@
 %include <gr_sync_block.i>
 %include <gr_sync_decimator.i>
 %include <gr_sync_interpolator.i>
+%include <gr_tags.i>
 %include <gr_top_block.i>
-- 
cgit v1.2.3