summaryrefslogtreecommitdiff
path: root/gruel/src/lib/pmt/pmt.cc
diff options
context:
space:
mode:
authorJosh Blum2012-04-03 14:50:06 -0700
committerJosh Blum2012-04-03 14:50:06 -0700
commit6cf6dc9c76bbacbecdb808c451ede9031668b34c (patch)
tree8c889c04d10f50644a5be344b5e6e026c7880d7e /gruel/src/lib/pmt/pmt.cc
parentc774e6efb5f715c5f8b5f20bd8dea0051da667fd (diff)
downloadgnuradio-6cf6dc9c76bbacbecdb808c451ede9031668b34c.tar.gz
gnuradio-6cf6dc9c76bbacbecdb808c451ede9031668b34c.tar.bz2
gnuradio-6cf6dc9c76bbacbecdb808c451ede9031668b34c.zip
pmt: added advanded pmt_set_deleter (c++ only)
Diffstat (limited to 'gruel/src/lib/pmt/pmt.cc')
-rw-r--r--gruel/src/lib/pmt/pmt.cc14
1 files changed, 13 insertions, 1 deletions
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 */