discuss-gnuradio
[Top][All Lists]
Advanced

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

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


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] PMT C++ example in GNU Radio Manual: UHD Interface
Date: Mon, 12 Dec 2016 19:58:18 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Hi Rich,

you've got that right – PMT pretty much enforces a paradigm of returning new objects when you need a modified version of something. 


Is there a right way to do this that doesn't require a left-hand side assignment?
No, your understanding is right, the documentation is wrong :)


Best regards,

Marcus


On 12/12/2016 07:30 PM, Collins, Richard wrote:
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


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

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