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

2014-10-10 Thread Daniele Nicolodi
Hello, this question my arise from my ignorance about C++, but I don't understand how, if it is possible, to sub-class a GNURadio block that has moat of his code in an _impl class. To my understanding I would need to subclass both the class defining the block and his _impl class. However, it

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

2014-10-10 Thread Martin Braun
You're right -- that's one of the reasons why we try and keep the block's guts (their kernels) elsewhere than the actual block definition. Not all of our blocks do this, though. M On 10/10/2014 12:03 PM, Daniele Nicolodi wrote: Hello, this question my arise from my ignorance about C++, but

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

2014-10-10 Thread Daniele Nicolodi
Hello Martin, I'm not sure I understand. Are you saying that there is no way of doing what I want without copying over to my class the implementation of the block that is in the _impl class? Why is this a good thing? Cheers, Daniele On 10/10/14 12:16, Martin Braun wrote: You're right --

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

2014-10-10 Thread Johannes Demel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Daniele, _impl classes are not meant to be subclassed usually. GR distinguishes between interface or public headers, which are located in the include directory and private headers which are located in the lib directory. You can just add new

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

2014-10-10 Thread Sylvain Munaut
Hi, There is way to achieve this without copying around significant portions of code? No, you'll need to copy the _impl The case at hand is subclassing gr::analog::pll_carriertracking_cc changing the phase_detector() method to use the regular atan2() instead of the fast version. Actually

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

2014-10-10 Thread Daniele Nicolodi
On 10/10/14 12:25, Johannes Demel wrote: _impl classes are not meant to be subclassed usually. GR distinguishes between interface or public headers, which are located in the include directory and private headers which are located in the lib directory. You can just add new classes to your lib

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

2014-10-10 Thread Jeff Long
The good part is the separation of the API from the implementation. The not so good thing is that the implementations themselves often contain all the logic, usually because they are fairly simple. So, your choices are to subclass or copy/edit the implementation files. [Just saw Sylvain's not

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

2014-10-10 Thread Daniele Nicolodi
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

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

2014-10-10 Thread Daniele Nicolodi
On 10/10/14 14:29, Daniele Nicolodi wrote: 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

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

2014-10-10 Thread Marcus Müller
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I think it might be more of a C++-inherent thing: If you declare a method in a class: class daniele_s_class { public: void my_method(int argument); }; Then you'll have to either implement that method, or can't instantiate the class -- which is kind