discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Casting an input value using block() function


From: Jose Torres Diaz
Subject: Re: [Discuss-gnuradio] Casting an input value using block() function
Date: Mon, 5 Nov 2012 17:27:02 +1030

Thanks Bastian,

This fix the issue,

Regards,

Jose

On Mon, Nov 5, 2012 at 5:11 PM, Bastian Bloessl <address@hidden> wrote:
Hi Jose,


On 11/05/2012 01:12 AM, Jose Torres Diaz wrote:
  int work(
         const InputItems &input_items,
         const OutputItems &output_items
     ){

       std::complex<float> * in =
input_items[0].cast<std::complex<float> *>();

 const std::complex<float> * in = input_items[0].cast<const std::complex<float> *>();

should do it. With gr_complex it looks a bit nicer:

const gr_complex *in = input_items[0].cast<const gr_complex*>();


       std::complex<float> * out =
output_items[0].cast<std::complex<float> *>();

      //Processing here

     } //End of work function

I can cast the output without problem, but I cannot do it for the input.
I got the following error:


/home/project/grextras/include/gnuradio/block.h: In member function ‘T
gnuradio::Buffer<PtrType>::cast() const [with T = std::complex<float>*,
PtrType = const void*]’:
/home/project/grextras/lib/s_asrp_st2up_insertcp.cc:76:77:
instantiated from here
/home/project/grextras/include/gnuradio/block.h:43:47: error:
reinterpret_cast from type ‘const void*’ to type ‘std::complex<float>*’
casts away qualifiers


Bastian





reply via email to

[Prev in Thread] Current Thread [Next in Thread]