discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] PMT C++ example in GNU Radio Manual: UHD Interface


From: Collins, Richard
Subject: [Discuss-gnuradio] PMT C++ example in GNU Radio Manual: UHD Interface
Date: Mon, 12 Dec 2016 13:30:58 -0500

Hello,

Something that has tripped me up a couple times when messing around with PMTs is I forget that there's a left-hand argument to pmt::dict_add (especially since the first argument is the pmt dictionary I want to update). Being a little new to this still, it took me a little while to figure out what the problem was.

on http://gnuradio.org/doc/doxygen/page_uhd.html#uhd_command_syntax there is the following example:
pmt::pmt_t command = pmt::make_dict();
pmt::dict_add(command, pmt::mp("freq"), pmt::mp(1.1e9)); // Specify frequency
pmt::dict_add(command, pmt::mp("chan"), pmt::mp(1)); // Specify channel

but, I believe it should be like this instead (unless I've just been doing something wrong):
pmt::pmt_t command = pmt::make_dict();
command = pmt::dict_add(command, pmt::mp("freq"), pmt::mp(1.1e9)); // Specify frequency
command = pmt::dict_add(command, pmt::mp("chan"), pmt::mp(1)); // Specify channel

Again, I could be totally wrong, but it's my experience that pmt::dict_add only returns a new dictionary as a return value, and not to the (address of?) the dictionary that was passed in.

Is there a right way to do this that doesn't require a left-hand side assignment? Should I instead be passing the address of the dictionary, or something? Again, total newb.

Thanks,

Rich

reply via email to

[Prev in Thread] Current Thread [Next in Thread]