# Question about set\_output\_multiple

**URL:** <https://www.ruby-forum.com/t/question-about-set-output-multiple/242312>\
**Category:** GNU Radio\
**Created:** [June 15, 2015, 5:14am UTC](https://www.ruby-forum.com/t/question-about-set-output-multiple/242312 "2015-06-15T05:14:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [June 15, 2015, 5:14am UTC](https://www.ruby-forum.com/t/question-about-set-output-multiple/242312/1 "2015-06-15T05:14:19Z")

</div>

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](http://gnuradio.4.n7.nabble.com/question-about-set-output-multiple-tp54173.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![dcardona](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a698b9/32.png) [@dcardona](https://www.ruby-forum.com/u/dcardona)\
**Post date:** [June 15, 2015, 9:19am UTC](https://www.ruby-forum.com/t/question-about-set-output-multiple/242312/2 "2015-06-15T09:19:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dcardona](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a698b9/32.png) [@dcardona](https://www.ruby-forum.com/u/dcardona)\
**Post date:** [June 15, 2015, 5:46pm UTC](https://www.ruby-forum.com/t/question-about-set-output-multiple/242312/3 "2015-06-15T17:46:10Z")

</div>

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](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](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](http://gnuradio.4.n7.nabble.com/question-about-set-output-multiple-tp54173p54187.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![dcardona](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a698b9/32.png) [@dcardona](https://www.ruby-forum.com/u/dcardona)\
**Post date:** [June 15, 2015, 6:07pm UTC](https://www.ruby-forum.com/t/question-about-set-output-multiple/242312/4 "2015-06-15T18:07:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dcardona](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a698b9/32.png) [@dcardona](https://www.ruby-forum.com/u/dcardona)\
**Post date:** [June 15, 2015, 6:49pm UTC](https://www.ruby-forum.com/t/question-about-set-output-multiple/242312/5 "2015-06-15T18:49:52Z")

</div>

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](http://gnuradio.4.n7.nabble.com/question-about-set-output-multiple-tp54173p54191.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).
