summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/grc_gr_fcd.m42
-rw-r--r--gr-fcd/lib/fcd_source_c_impl.cc2
-rw-r--r--gr-fcd/swig/CMakeLists.txt3
-rw-r--r--gr-fcd/swig/Makefile.am3
-rw-r--r--gr-fcd/swig/fcd_source_c.i22
-rw-r--r--gr-fcd/swig/fcd_swig.i10
-rw-r--r--gruel/src/include/gruel/pmt.h19
-rw-r--r--gruel/src/lib/pmt/pmt.cc14
-rw-r--r--gruel/src/lib/pmt/pmt_int.h9
9 files changed, 55 insertions, 29 deletions
diff --git a/config/grc_gr_fcd.m4 b/config/grc_gr_fcd.m4
index 8094e1926..61727168f 100644
--- a/config/grc_gr_fcd.m4
+++ b/config/grc_gr_fcd.m4
@@ -32,7 +32,7 @@ AC_DEFUN([GRC_GR_FCD],[
AC_SUBST(USB_CPPFLAGS)
AC_SUBST(USB_LIBS)
- FCD_CPPFLAGS="${FCD_CPPFLAGS} -I\${abs_top_srcdir}/gr-fcd/include"
+ FCD_CPPFLAGS="${FCD_CPPFLAGS} -I\${abs_top_srcdir}/gr-fcd/include/fcd"
AC_SUBST(FCD_CPPFLAGS)
case "$target" in
diff --git a/gr-fcd/lib/fcd_source_c_impl.cc b/gr-fcd/lib/fcd_source_c_impl.cc
index 9543f16eb..ca370d9f3 100644
--- a/gr-fcd/lib/fcd_source_c_impl.cc
+++ b/gr-fcd/lib/fcd_source_c_impl.cc
@@ -47,7 +47,7 @@ static const int MIN_OUT = 1; /*!< Minimum number of output streams. */
static const int MAX_OUT = 1; /*!< Maximum number of output streams. */
fcd_source_c_impl::fcd_source_c_impl(const std::string device_name)
- : gr_hier_block2 ("fcd_source_c_impl",
+ : gr_hier_block2 ("fcd_source_c",
gr_make_io_signature (MIN_IN, MAX_IN, sizeof (gr_complex)),
gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (gr_complex))),
d_freq_corr(-120),
diff --git a/gr-fcd/swig/CMakeLists.txt b/gr-fcd/swig/CMakeLists.txt
index 7d881c0b4..f715c4785 100644
--- a/gr-fcd/swig/CMakeLists.txt
+++ b/gr-fcd/swig/CMakeLists.txt
@@ -23,6 +23,8 @@
include(GrPython)
include(GrSwig)
+#set(GR_SWIG_FLAGS -DGR_HAVE_FCD) #needed to parse fcd_swig.i
+
set(GR_SWIG_INCLUDE_DIRS
${GR_FCD_INCLUDE_DIRS}
${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
@@ -45,7 +47,6 @@ GR_SWIG_INSTALL(
install(
FILES
fcd_swig.i
- fcd_source_c.i
${CMAKE_CURRENT_BINARY_DIR}/fcd_swig_doc.i
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
COMPONENT "fcd_swig"
diff --git a/gr-fcd/swig/Makefile.am b/gr-fcd/swig/Makefile.am
index cec8fa29a..225f32ae0 100644
--- a/gr-fcd/swig/Makefile.am
+++ b/gr-fcd/swig/Makefile.am
@@ -43,6 +43,8 @@ AM_CPPFLAGS = \
# The SWIG library
# TESTS = run_tests
+fcd_swig_swig_args = $(FCD_CPPFLAGS)
+
TOP_SWIG_DOC_IFILES = \
fcd_swig_doc.i
@@ -72,7 +74,6 @@ fcd_swig_la_swig_libadd = \
# additional SWIG files to be installed
fcd_swig_swiginclude_headers = \
- fcd_source_c.i \
$(TOP_SWIG_DOC_IFILES)
if GUILE
diff --git a/gr-fcd/swig/fcd_source_c.i b/gr-fcd/swig/fcd_source_c.i
deleted file mode 100644
index 77fcf8a42..000000000
--- a/gr-fcd/swig/fcd_source_c.i
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * First arg is the package prefix.
- * Second arg is the name of the class minus the prefix.
- *
- * This does some behind-the-scenes magic so we can
- * access fcd_source_c from python as fcd.source_c
- */
-GR_SWIG_BLOCK_MAGIC(fcd,source_c);
-
-fcd_source_c_sptr fcd_make_source_c (const std::string device_name = "");
-
-class fcd_source_c : public gr_hier_block2
-{
-public:
- void set_freq(float freq);
- void set_freq_khz(int freq);
- void set_lna_gain(float gain);
- void set_mixer_gain(float gain);
- void set_freq_corr(int ppm);
- void set_dc_corr(double dci, double dcq);
- void set_iq_corr(double gain, double phase);
-};
diff --git a/gr-fcd/swig/fcd_swig.i b/gr-fcd/swig/fcd_swig.i
index a565fb895..8fcc7d059 100644
--- a/gr-fcd/swig/fcd_swig.i
+++ b/gr-fcd/swig/fcd_swig.i
@@ -20,6 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
+#define FCD_API
+
+//suppress 319. No access specifier given for base class name (ignored).
+#pragma SWIG nowarn=319
+
%include "gnuradio.i"
//load generated python docstrings
@@ -29,7 +34,10 @@
#include "fcd_source_c.h"
%}
-%include "fcd_source_c.i"
+%include "fcd_source_c.h"
+
+GR_SWIG_BLOCK_MAGIC(fcd,source_c);
+fcd_source_c_sptr fcd_make_source_c (const std::string device_name = "");
#if SWIGGUILE
%scheme %{
diff --git a/gruel/src/include/gruel/pmt.h b/gruel/src/include/gruel/pmt.h
index 58533e54e..f904d37e1 100644
--- a/gruel/src/include/gruel/pmt.h
+++ b/gruel/src/include/gruel/pmt.h
@@ -32,6 +32,7 @@
#include <stdint.h>
#include <iosfwd>
#include <stdexcept>
+#include <boost/function.hpp>
namespace gruel {
class msg_accepter;
@@ -805,6 +806,24 @@ GRUEL_API std::string pmt_serialize_str(pmt_t obj);
*/
GRUEL_API pmt_t pmt_deserialize_str(std::string str);
+/*
+ * ------------------------------------------------------------------------
+ * advanced
+ * ------------------------------------------------------------------------
+ */
+
+#define GRUEL_PMT_HAVE_PMT_SET_DELETER
+
+/*!
+ * Set a deleter function to be called when the PMT dereferences.
+ * User beware! This function is for extremely advanced use.
+ * Use boost bind to bind extra parameters into the deleter function.
+ * Set an empty function type to reset the PMT to the default deleter.
+ * \param obj the pmt object in which to set the deleter function
+ * \param deleter a function that gets an opaque PMT pointer type
+ */
+GRUEL_API void pmt_set_deleter(pmt_t obj, boost::function<void(pmt_base *)> &deleter);
+
} /* namespace pmt */
#include <gruel/pmt_sugar.h>
diff --git a/gruel/src/lib/pmt/pmt.cc b/gruel/src/lib/pmt/pmt.cc
index f9cf6b4bf..57b66b1a4 100644
--- a/gruel/src/lib/pmt/pmt.cc
+++ b/gruel/src/lib/pmt/pmt.cc
@@ -58,7 +58,7 @@ pmt_base::operator delete(void *p, size_t size)
#endif
void intrusive_ptr_add_ref(pmt_base* p) { ++(p->count_); }
-void intrusive_ptr_release(pmt_base* p) { if (--(p->count_) == 0 ) delete p; }
+void intrusive_ptr_release(pmt_base* p) { if (--(p->count_) == 0 ) p->deleter_(p); }
pmt_base::~pmt_base()
{
@@ -1383,4 +1383,16 @@ pmt_dump_sizeof()
printf("sizeof(pmt_uniform_vector) = %3zd\n", sizeof(pmt_uniform_vector));
}
+/*
+ * ------------------------------------------------------------------------
+ * advanced
+ * ------------------------------------------------------------------------
+ */
+
+void
+pmt_set_deleter(pmt_t obj, boost::function<void(pmt_base *)> &deleter)
+{
+ obj->deleter_ = (deleter)? deleter : &pmt_base::default_deleter;
+}
+
} /* namespace pmt */
diff --git a/gruel/src/lib/pmt/pmt_int.h b/gruel/src/lib/pmt/pmt_int.h
index 3a5cd382b..745dbc666 100644
--- a/gruel/src/lib/pmt/pmt_int.h
+++ b/gruel/src/lib/pmt/pmt_int.h
@@ -38,8 +38,15 @@ namespace pmt {
class GRUEL_API pmt_base : boost::noncopyable {
mutable boost::detail::atomic_count count_;
+public:
+ static void default_deleter(pmt_base *p){
+ delete p;
+ }
+
+ boost::function<void(pmt_base *)> deleter_;
+
protected:
- pmt_base() : count_(0) {};
+ pmt_base() : count_(0), deleter_(&pmt::pmt_base::default_deleter) {};
virtual ~pmt_base();
public: