# Vector inputs/outputs with GRExtras block interface

**URL:** <https://www.ruby-forum.com/t/vector-inputs-outputs-with-grextras-block-interface/224490>\
**Category:** GNU Radio\
**Created:** [November 13, 2012, 11:36pm UTC](https://www.ruby-forum.com/t/vector-inputs-outputs-with-grextras-block-interface/224490 "2012-11-13T23:36:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [November 13, 2012, 11:36pm UTC](https://www.ruby-forum.com/t/vector-inputs-outputs-with-grextras-block-interface/224490/1 "2012-11-13T23:36:59Z")

</div>

Is it possible to use a vector input or output with a block that uses  
the GRExtras interface? All of the examples for specifying the I/O  
signature for a Python block only show using a numpy type to specify  
the data width.

I also tried creating a C++ block and setting the sizeof\_stream\_item  
parameter of the gr\_make\_io\_signature() to the total vector size as  
has been done in standard blocks that support vectors, but it doesn’t  
appear to be working properly either. For example, I tried setting  
the size to 4096 bytes (vector of 1024 floats), but each time my work  
function gets called, input\_items.size() is only returning 8, where I  
would have expected it to only be called when there was a full vector  
of data available?

I suppose I could work around this with a vector to stream conversion  
block in front of it, but I just wanted to see if it is possible to  
directly accept vectors with the newer block interface.

Thanks,  
Roy

---

<div class="post-metadata">

**Author:** ![roytruelove](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3ab097/32.png) [@roytruelove](https://www.ruby-forum.com/u/roytruelove)\
**Post date:** [November 13, 2012, 11:42pm UTC](https://www.ruby-forum.com/t/vector-inputs-outputs-with-grextras-block-interface/224490/2 "2012-11-13T23:42:49Z")

</div>

On 11/13/2012 02:35 PM, Roy T. wrote:

> Is it possible to use a vector input or output with a block that uses  
> the GRExtras interface? All of the examples for specifying the I/O  
> signature for a Python block only show using a numpy type to specify  
> the data width.

Actually the neat thing with the python blocks is the items can be any  
thing you can represent with numpy dtypes. So vectors, vectors of  
vectors with arbitrary sizes, structures. And when work gets called, you  
get the inputs and outputs as arrays of these types.

> I also tried creating a C++ block and setting the sizeof\_stream\_item  
> parameter of the gr\_make\_io\_signature() to the total vector size as  
> has been done in standard blocks that support vectors, but it doesn’t  
> appear to be working properly either. For example, I tried setting  
> the size to 4096 bytes (vector of 1024 floats), but each time my work  
> function gets called, input\_items.size() is only returning 8, where I  
> would have expected it to only be called when there was a full vector  
> of data available?

input\_items is an array of arrays, where each element represents an  
input port. If input\_items.size() == 8, then you must have a block w/ 8  
inputs?

-josh
