[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] two inputs/outputs of different data types
From: |
Eric Blossom |
Subject: |
Re: [Discuss-gnuradio] two inputs/outputs of different data types |
Date: |
Wed, 26 Apr 2006 09:37:58 -0700 |
User-agent: |
Mutt/1.5.9i |
On Wed, Apr 26, 2006 at 11:50:39AM -0400, Chuck Swiger wrote:
> 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
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 ;) ]
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