discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] How do I use arguments outside of functions


From: Martin Braun
Subject: Re: [Discuss-gnuradio] How do I use arguments outside of functions
Date: Fri, 9 Dec 2016 10:17:31 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

You can have an intermediate function that translates your arguments
into an IO signature, see e.g. here:
https://github.com/gnuradio/gnuradio/blob/1e8562c8d5430667b48fced2d2e50ab5771dfb5e/gr-uhd/lib/usrp_source_impl.cc#L71

Also, you have until the end of your ctor to figure out the IO
signature. This is a more elaborate example: First, we set a default IO
signature:
https://github.com/EttusResearch/gr-ettusdev/blob/335e959d0de53cee12fc4eefb43d7947f8510a2a/lib/rfnoc_block_impl.cc#L132-L133

Then, we do a bunch of things that determine what the actual IO
signature is. Once we know that, it gets updated here:
https://github.com/EttusResearch/gr-ettusdev/blob/335e959d0de53cee12fc4eefb43d7947f8510a2a/lib/rfnoc_block_impl.cc#L177

Note you have to finish all of these settings until your ctor exits.

-- M

On 12/07/2016 09:49 PM, Ashley Neboschick wrote:
> I am trying to create an io signature with multiple inputs greater than
> 3 using makev.  in order to do this, I learned to do it according to the
> code below.  My issue is that I need to derive the input sizes from the
> input arguments but I don't know how I would do that.  I imagine using a
> separate function but I am just learning objects and do not know how I
> would word it specifically for gnuradio. An example would be extremely
> helpful. Any help much appreciated.
> 
> 
>     //static int ios[] = {sizeof(gr_complex)*nAz*M,
> sizeof(gr_complex)*M*M, sizeof(gr_complex)*M*L, sizeof(float)}; //but I
> want to get this line to work instead
>     static int ios[] = {sizeof(gr_complex)*121*4,
> sizeof(gr_complex)*4*4, sizeof(gr_complex)*4*128, sizeof(float)}; //this
> line already works...^^^
>     static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
> 
>     /*
>      * The private constructor
>      */
>     MVDR_impl::MVDR_impl(int L, int M, int nAz, float InitialLook)
>       : gr::sync_block("MVDR",
>                 gr::io_signature::makev(4, 4, iosig),
>                 //gr::io_signature::makev(4, 4,
> sizeof(gr_complex)*nAz*M, sizeof(gr_complex)*M*M,
> sizeof(gr_complex)*M*L, sizeof(float) ),        
>         //steering vectors (all), covariance matrix (RXX),look direction
> (LookDir), origional MxL IQ Data matrix
>        
>         gr::io_signature::make(1, 1, sizeof(gr_complex)*L)), //"steered"
> data
>             d_L(L),
>                 d_M(M),
>         d_nAz(nAz),
>         d_InitialLook(InitialLook) //not used currently
>     {}
> 
> 
> 
> _______________________________________________
> 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]