diff options
author | Marcus Müller <mueller@kit.edu> | 2018-02-20 13:03:12 +0100 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2018-02-23 19:06:50 +0100 |
commit | 9b63bb4f4a52c172ea8f4ebf8e0577cf101da69c (patch) | |
tree | 51c03403bf33ceb33a29d3e3917082d5bb4bd439 /gr-qtgui/lib/sink_c_impl.cc | |
parent | 28401b7a01d9e6f25c6057f7b9dc07c8e568ff60 (diff) |
qtgui: remove unnecessary call to pmt::intern at runtime
typical usage:
message_port_pub(pmt::mp("out_port"), …)
which is bad, as it implies hashing of a string, allocation of memory,
deallocation, finding the hashed string in the table of interned strings
and returning a unique pointer (which for reasons of PMT awesomeness
isn't even unique) to the interned port name.
Replacing all these port name ad hoc ::mp() calls by reusing one,
private, port name member.
Diffstat (limited to 'gr-qtgui/lib/sink_c_impl.cc')
-rw-r--r-- | gr-qtgui/lib/sink_c_impl.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gr-qtgui/lib/sink_c_impl.cc b/gr-qtgui/lib/sink_c_impl.cc index ba34eaaa32..77f87c1e0c 100644 --- a/gr-qtgui/lib/sink_c_impl.cc +++ b/gr-qtgui/lib/sink_c_impl.cc @@ -63,7 +63,8 @@ namespace gr { d_center_freq(fc), d_bandwidth(bw), d_name(name), d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall), d_plottime(plottime), d_plotconst(plotconst), - d_parent(parent) + d_parent(parent), + d_port(pmt::mp("freq")) { // Required now for Qt; argc must be greater than 0 and argv // must have at least one valid character. Must be valid through @@ -75,9 +76,9 @@ namespace gr { // setup output message port to post frequency when display is // double-clicked - message_port_register_out(pmt::mp("freq")); - message_port_register_in(pmt::mp("freq")); - set_msg_handler(pmt::mp("freq"), + message_port_register_out(d_port); + message_port_register_in(d_port); + set_msg_handler(d_port, boost::bind(&sink_c_impl::handle_set_freq, this, _1)); d_main_gui = NULL; @@ -328,8 +329,8 @@ namespace gr { { if(d_main_gui->checkClicked()) { double freq = d_main_gui->getClickedFreq(); - message_port_pub(pmt::mp("freq"), - pmt::cons(pmt::mp("freq"), + message_port_pub(d_port, + pmt::cons(d_port, pmt::from_double(freq))); } } |