Dear Sir,

Is this a good alternative?
   gr_make_io_signature2 (2, 2, sizeof(float), sizeof(double))

http://stackoverflow.com/questions/14347626/how-to-define-a-block-with-2-inputs

Is this considered a correct answer?
  http://lists.gnu.org/archive/html/discuss-gnuradio/2013-01/msg00193.html

Regards.


On Thu, Jan 16, 2014 at 4:14 PM, Marcus Müller <mar...@hostalia.de> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Activecat,
>
> you're right. Method calls (or function calls in general) such us
> push_back can only take place in functions. That's why constructors
> exist! Please refer to your favourite C++ literature for more
> information. As you understood correctly, this is a C++ problem, and
> not really GR-related.
> Your code won't compile even after moving these calls into a function,
> because you yet have to replace the <+ +> placeholders.
>
> Then: Working in namespace gr::howto is really deprecated. To get a
> working, correctly named module infrastructure fitting your
> installation of GR (which hopefully is either v3.6.5 or 3.7.X), please
> use gr_modtool.
>
>
> Greetings,
> Marcus
>
>
>
> On 16.01.2014 08:46, Activecat wrote:
> > Dear Sir,
> >
> > Below code will produce compilation error:  'input_sizes' does not
> > name a type. This is because input_sizes must be assigned inside a
> > context of a function in c++, right ?
> >
> > std::vector<int> input_sizes;
> > input_sizes.push_back(sizeof(float));
> > input_sizes.push_back(sizeof(double)); gr_sync_block("my block",
> > gr_make_io_signaturev(2, 2, input_sizes), gr_make_io_signature(1,
> > 1, sizeof(float)))
> >
> > Source:
> >
> http://gnuradio.org/redmine/projects/gnuradio/wiki/BlocksCodingGuide#IO-signatures
> >
> >
> >
> > My code (which produce error) is below.
> >
> > [code] /* -*- c++ -*- */
> >
> > #ifdef HAVE_CONFIG_H #include "config.h" #endif
> >
> > #include <gr_io_signature.h> #include <vector> #include <complex>
> > #include "sample_and_hold_cc_impl.h"
> >
> > namespace gr { namespace howto {
> >
> > sample_and_hold_cc::sptr sample_and_hold_cc::make() { return
> > gnuradio::get_initial_sptr (new sample_and_hold_cc_impl()); }
> >
> > /* * The private constructor */
> >
> > std::vector <int> xx; xx.push_back(25); xx.push_back( sizeof( float
> > ) ); xx.push_back( sizeof( std::complex<float> ) );
> >
> > sample_and_hold_cc_impl::sample_and_hold_cc_impl() :
> > gr_sync_block("sample_and_hold_cc",
> > gr_make_io_signature(<+MIN_IN+>, <+MAX_IN+>, sizeof(<+ITYPE+>)),
> > gr_make_io_signature(<+MIN_OUT+>, <+MAX_OUT+>, sizeof(<+OTYPE+>)))
> > {}
> >
> > /* * Our virtual destructor. */
> > sample_and_hold_cc_impl::~sample_and_hold_cc_impl() { }
> >
> > int sample_and_hold_cc_impl::work(int noutput_items,
> > gr_vector_const_void_star &input_items, gr_vector_void_star
> > &output_items) { const <+ITYPE+> *in = (const <+ITYPE+> *)
> > input_items[0]; <+OTYPE+> *out = (<+OTYPE+> *) output_items[0];
> >
> > // Do <+signal processing+>
> >
> > // Tell runtime system how many output items we produced. return
> > noutput_items; }
> >
> > } /* namespace howto */ } /* namespace gr */ [/code]
> >
> >
> >
> > _______________________________________________ Discuss-gnuradio
> > mailing list Discuss-gnuradio@gnu.org
> > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> >
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQEcBAEBAgAGBQJS15T5AAoJEAFxB7BbsDrLV2MH/2/h8v1nkK+80GrwJCzRDJkG
> cb3qh3FJ890Xp0uZfj0RX+Gpv90wPas5Xia2KAb76QUOzS00J1M88vTG6kDYUaa1
> R0Ak4m2S2Ehc1ir1AvZ0z0yZi4umKHAdD8mcCjPDSC05+Qq04QtjzfMtjFNyIMXV
> 872n9G0JBllRyfUlC2lRPMyCkRVSSLGfzLkShu25rlm4WImdfi+0uHHjhDjTAEV6
> DwWm/5JuO0wtzzx3w7kKx0kD5COMUmsBZuWUjokcB1gr7MUKA2OKa1PdIa1a8t80
> D1L+6S3Ax7m2LRVl8qJK4MqrvSKzDbzJLdqpPUHZjhim0m3r/Gp5etCqxSkir4M=
> =5OP/
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to