Two inputs/outputs of different data types

How do you declare two inputs of different data types?

Several atsc blocks pass a stream of ‘float’ and also ‘syminfo’
(a struct of 4 ints).

From what I can tell, gr_sync_block allows many inputs and outputs,
but only of the same type(?).

gr_block::gr_block (const std::string &name,
gr_io_signature_sptr input_signature,
gr_io_signature_sptr output_signature)

where

gr_io_signature (int min_streams, int max_streams, size_t
sizeof_stream_item)

tia
–Chuck

On Wed, Apr 26, 2006 at 11:50:39AM -0400, Chuck Swiger wrote:

                gr_io_signature_sptr output_signature)

where

gr_io_signature (int min_streams, int max_streams, size_t
sizeof_stream_item)

tia
–Chuck

Hi Chuck,

You’re right. FWIW, the underlying representation is designed to
support different types on each input or output stream, but the top
level constructor, gr_io_signature, doesn’t implement an interface to
it.

I’m pretty sure that sizeof(atsc::syminfo) is 4, which is the same as
sizeof(float). This is true because the total width of the integer
bit fields in atsc::syminfo is <= 32.

Add

assert(sizeof(float) == sizeof(atsc::syminfo));

somewhere in work, and then cast away. We lose clarity in the i/o
signature, but I’m pretty sure it’ll work. [ It worked before :wink: ]

E.g.,

int
foo::work(…)
{
const float *in_sample = (const float *) input_items[0];
const atsc::syminfo *in_tag = (const atsc::syminfo *)
input_items[1];

 assert(sizeof(float) == sizeof(atsc::syminfo));

 ...

}

Eric

Hi,

I was just asking myself the same question but I’m not sure I understood
your answer.

Is it possible to have two output streams of different data types? I
want
one to be unsignad char and the other one float or double. How is it to
be
coded?

…: gr_sync_block (…,
gr_make_io_signature (1, 1, size_of (…))
gr_make_io_signature (1, 12, size_of (???)))

Regards,
Irene

Eric B. wrote:

gr_block::gr_block (const std::string &name,

int
Eric


Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page


View this message in context:
http://www.nabble.com/two-inputs-outputs-of-different-data-types-tp4104088p18253966.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Thu, Jul 03, 2008 at 01:11:47AM -0700, irene159 wrote:

…: gr_sync_block (…,
gr_make_io_signature (1, 1, size_of (…))
gr_make_io_signature (1, 12, size_of (???)))

Regards,
Irene

Hi Irene,

Take a look at gr_io_signature.h. The general case is
gr_make_io_signaturev.

Eric