Question about set_output_multiple

Hello

I’m trying to create a block whose number of outputs is the number of
inputs, which i’m setting as a parameter of the block(named tamano),+ n,
being n a parameter of the block too.
For example, if i use a vector sources block of size 16 as the input of
my
block, and n = 3, the output should be of size 19.
According to what i have read, i should use the set_output_multiple() to
achieve this.

Problem 1:
But i don’t know what is the correct way to do this, or where to set it.
I was doing it by writing: set_output_multiple(int tamano + n) at the
constructor, but i’m having an error: error: expected primary-expression
before ‘int’.

Problem 2:
I am trying to create this block with a c++ code and i don’t know how to
use
SWIG, i don’t know if i should convert the c++ code into a python code
using
SWIG and then copy it into the .cpp file generated, or if i copy the c++
code into it and then SWIG converts it to a python code using some
commands
in the terminal.

Could the problem 1 has something to do with the fact that I am trying
to
create this block with a c++ code?

Thank you very much.

David.


View this message in context:
http://gnuradio.4.n7.nabble.com/question-about-set-output-multiple-tp54173.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hello David,

Problem 1:

your “error: expected…” looks like there’s something small wrong with
your C++ syntax; would you mind sharing the code of your constructor (or
at least the signature and the lines containing set_output_multiple)?
Generally, “int tamano” declares the variable tamano as integere – I
think you might be fine if you just delete the “int”.

Problem 2:
SWIG can be hard. But usually, if you created the stub for your block
using “gr_modtool add”, then everything will be alright, and all the
methods defined in include/your_block_name.h will be available to
python, as long as they are easily wrappable (this mostly means that you
used basic parameter types only).

Best regards,
Marcus

Hello Marcus

Thank you for your response

Before, I was setting the set_output_multiple at the constructor in the
.cc
file and i was getting the error I said before
Then, I set it in the .h file and I had no error.

Is it correct to set it in the .h file? Here are both the .cc and the .
h
files.

In the .cc file, the set_output_multiple is commented.

Codificador_bf_impl.h
http://gnuradio.4.n7.nabble.com/file/n54187/Codificador_bf_impl.h
Codificador_bf_impl.cc
http://gnuradio.4.n7.nabble.com/file/n54187/Codificador_bf_impl.cc

Also, I set: int n;
ninput_items_required[0] = noutput_items - n;
at the forecast method. I did this for the reason i explained before; If
i
have for example 16 items at the in put, i need to have 16 + n items at
the
output. Is this configured right?

Another question: This is about the ninput_items. How should I set it
for
my requirements? I suppose this ninput_items should depend of “tamano”,
which is the size of the input stream.
Should I use ninput_items instead of tamano in the code? And if this
right,
should I set set_output_multiple(int ninput_items + n) instead of
set_output_multiple(int tamano + n)?

PD: In the .cc file you can take a look at the c++ code for the chaotic
coding if you like. And if you are interested, i can send you the c++
code
that gives those values of “zmean3”, “zmean6”, “secuencias3” and
“secuencias6” and the paper where the theory of this coding method is
specified.

Thank you very much.

David


View this message in context:
http://gnuradio.4.n7.nabble.com/question-about-set-output-multiple-tp54173p54187.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hi David,
yes, your .cc verified: your C++ was just syntactically incorrect:

   void set_output_multiple(int tamano + n);

won’t work. To call a method or function, you don’t use it’s full
signature, but just its name with the parameters filled in, so that line
must read
set_output_multiple(tamano+n);

and you should then not implement a output_multiple nested function
(this won’t have any effect, by the way).

Also, I set: int n;
ninput_items_required[0] = noutput_items - n;
This will define a local variable “n” which hides the parameter “n” that
you get; remove the “int n;” line! If you need “n” to be saved from your
constructors call, you must define it in the header and assign the
class’s “n” in the constructor. You do that wrong for “tamano”, too.

To be completely honest, you seem to be a little lost when it comes to
C++; maybe you should look a bit harder at how other blocks in GNU
Radio’s source code tree do that (you can use “grep -r ‘pattern’ .” in
your GNU Radio source code tree to find things like occurences of
set_output_multiple) and more importantly read a C++ tutorial before
diving right into GNU Radio.

Best regards,
Marcus

I thought I was doing it well.

Thank you Marcus, I will read then.

David


View this message in context:
http://gnuradio.4.n7.nabble.com/question-about-set-output-multiple-tp54173p54191.html
Sent from the GnuRadio mailing list archive at Nabble.com.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs