[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Re: one question about gr_chunks_to_symbols_bc
From: |
jiangfan shi |
Subject: |
Re: [Discuss-gnuradio] Re: one question about gr_chunks_to_symbols_bc |
Date: |
Sun, 21 Sep 2008 12:48:30 -0500 |
Thanks very much, Eric.
"...an STL vector of void *" gives me a very clear idea of the input_items.
I will definitely look into the gnuradio code more broadly to
understand it more deeply.
Jiangfan
On Sun, Sep 21, 2008 at 12:27 PM, Eric Blossom <address@hidden> wrote:
> On Sun, Sep 21, 2008 at 11:56:08AM -0500, jiangfan shi wrote:
>> Thanks, Eric.
>>
>> >> > for (int m=0;m<nstreams;m++) {
>> >> > const unsigned char *in = (unsigned char *) input_items[m];
>>
>> Maybe I do not express my questions clearly. Basically I am asking
>> what the above code statement means. My understanding is that the
>> input_items is a 2-dimension array.
>
> input_items is of type gr_vector_const_void_star.
>
> Searching for the definition of gr_vector_const_void_star reveals it's
> a typedef living in gr_types.h:
>
> typedef std::vector<const void *> gr_vector_const_void_star;
>
> Thus, it's not a 2-dimensional array, but rather an STL vector of void *.
>
> The void*'s point into memory allocated by the system that holds the
> input data for the block.
>
> Please see
> http://www.gnu.org/software/gnuradio/doc/howto-write-a-block.html
> for additional information.
>
>
> The following lines cast the void * to a type that matches the actual
> type of the input. In this case it's unsigned char.
>
>> >> > for (int m=0;m<nstreams;m++) {
>> >> > const unsigned char *in = (unsigned char *) input_items[m];
>
>
> If any of this is still not clear, you may want to refer to a good C++
> and/or STL introduction.
>
> Eric
>