[Top][All Lists]

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

Re: [Discuss-gnuradio] Sub-classing a block defined in an _impl class

From: Daniele Nicolodi
Subject: Re: [Discuss-gnuradio] Sub-classing a block defined in an _impl class
Date: Fri, 10 Oct 2014 14:29:28 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.1.2

On 10/10/14 12:30, Sylvain Munaut wrote:
> Hi,
>> There
>> is way to achieve this without copying around significant portions of code?
> No, you'll need to copy the _impl

Ok. Thanks for confirming my understanding.

I copied the _impl definition, however, I would prefer to do not copy
the interface definition, therefore I defined my block as follows:

namespace gr {
  namespace baz {

    class BAZ_API pll_carriertracking_cc
      : public gr::analog::pll_carriertracking_cc
      typedef boost::shared_ptr<pll_carriertracking_cc> sptr;
      static sptr make(float loop_bw, float max_freq, float min_freq);

  } // namespace baz
} // namespace gr

Then I copied the definition of the pll_carriertracking_cc_impl class
implementation into my project and changed it where I wanted.

However, in this way, swig is not happy:

 src/gr-baz/swig/baz_swigPYTHON_wrap.cxx: In function 'PyObject*
_wrap_new_pll_carriertracking_cc(PyObject*, PyObject*)':
 /home/manip/src/gr-baz/swig/baz_swigPYTHON_wrap.cxx:11071:87: error:
cannot allocate an object of abstract type 'gr::baz::pll_carriertracking_cc'
        result = (gr::baz::pll_carriertracking_cc *)new

But if I copy the definition of my block from the GNURadio definition,
swig is happy, the compilation goes fine, and I can correctly use the
block from Python.

What am I doing wrong?  Sorry if this is a trivial C++ error, but my C++
is definitely rusty...



reply via email to

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