discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] About Polymorphic types in gnuradio


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] About Polymorphic types in gnuradio
Date: Wed, 6 Jan 2016 17:23:24 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

Ah, so it's a uniform vector of _u_signed _8_bit integers.
Try pmt::u8vector_ref(VECT, k), where k is the index of the element you want to get. To modify, use pmt::u8vector_set(pmt_t, index,value).

Since your pmt is really just a wrapper around memory-contiguous uint8_ts , you can also "cheat" and directly use the uint8_t* pmt::u8vector_writable_elements(pmt_t v, size_t & len) method, that will give you a C-array/pointer to the first element.

All these functions are described on
https://gnuradio.org/doc/doxygen/namespacepmt.html#a73605a64c44ec7f12f5f84bb98e2cae3
as linked from the page I mentioned below.

Best regards,
Marcus

On 06.01.2016 17:13, Gabriel Pechiarovich wrote:
I'm using message strobe to send the data in the Message PMt parameter I used:

pmt.cons(pmt.make_dict(), pmt.make_u8vector(8,0x42 ))

then comes my block, and to read the output i'm using Message Debug block.



2016-01-06 10:55 GMT-05:00 Marcus Müller <address@hidden>:
Hi Gabriel,

do you know what kind of PMT VECT is? pmt_t is a container, and might contain a lot of different things.
Is it a pmt::vector, or a pmt::uniform_vector, or a list, or something else?

For an overview, I'd like to point you to the polymorphic types page in the GNU Radio manual [1].

Best regards,
Marcus

[1] https://gnuradio.org/doc/doxygen/page_pmt.html


On 06.01.2016 16:10, Gabriel Pechiarovich wrote:
Hi, I've been working in oot modules in gnuradio for a while, but recently I've been trying to program blocks who can handle messages.

I've extracted the input data and replicated it at the output, like this:

pmt::pmt_t META = pmt::car(PDU);
pmt::pmt_t VECT = pmt::cdr(PDU);
        std::cout << "Vect: " << VECT<< '\n';
message_port_pub(pmt::mp("out_pdu"), pmt::cons(META, VECT));

But I can't understand how to handle VECT, I want to change the VECT values; add some values, basicaly operate this VECT.

If anyone can help me I'll be gratefull.

--
Gabriel Pechiarovich Salas



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


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




--
Gabriel Pechiarovich Salas
Red Dragon Games
Designers and game developers


reply via email to

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