Hi Ashley,
welcome to GNU Radio development!
So, yes, you're right, you can't use the arguments of a
method/function/constructor anywhere but in the same
method/function/constructor. So, your "static int" approach can't work –
at the point the ios variable exists, there's no knowing what parameters
the constructor will be called with.
So, you'll have to do the gr::io_signature::makev call within the
constructor, there's no way around that.
you should *not* be using static here, at all. Static is for things that
are common to all /instances/ of a class, and that means that you
couldn't have to instances of your MVDL_impl with different ios . That'd
be a design error.
Hope that explains things well enough!
Best regards,
Marcus
PS: I like your question because it's a common coding problem
encountered by GR developers, so it's very on-topic here! Note that in
general, OOP/C++ questions might be less positively received here –
please don't hesitate to ask us anything, but please don't be sad if it
happens that you ask a question that we'll have to answer with "um,
that's a legit question, but it's a C++ programming, not a GNU
Radio-specific one, so we might not be the right folks to ask about
that" :) Generally, people on here tend to be pretty helpful, because
most (all?) of us like GNU Radio and coding :)
On 08.12.2016 06:49, 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
> [email protected]
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio