summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/block_registry.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-runtime/lib/block_registry.cc')
-rw-r--r--gnuradio-runtime/lib/block_registry.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/gnuradio-runtime/lib/block_registry.cc b/gnuradio-runtime/lib/block_registry.cc
index c4dc7647d6..5241ef9922 100644
--- a/gnuradio-runtime/lib/block_registry.cc
+++ b/gnuradio-runtime/lib/block_registry.cc
@@ -90,6 +90,26 @@ namespace gr {
d_ref_map = pmt::dict_add(d_ref_map, pmt::intern(name), pmt::make_any(block));
}
+ void
+ block_registry::update_symbolic_name(basic_block* block, std::string name)
+ {
+ gr::thread::scoped_lock guard(d_mutex);
+
+ if(pmt::dict_has_key(d_ref_map, pmt::intern(name))) {
+ throw std::runtime_error("symbol already exists, can not re-use!");
+ }
+
+ // If we don't already have an alias, don't try and delete it.
+ if(block->alias_set()) {
+ // And make sure that the registry has the alias key.
+ // We test both in case the block's and registry ever get out of sync.
+ if(pmt::dict_has_key(d_ref_map, block->alias_pmt())) {
+ d_ref_map = pmt::dict_delete(d_ref_map, block->alias_pmt());
+ }
+ }
+ d_ref_map = pmt::dict_add(d_ref_map, pmt::intern(name), pmt::make_any(block));
+ }
+
basic_block_sptr
block_registry::block_lookup(pmt::pmt_t symbol)
{