|
From: | Tom Rondeau |
Subject: | Re: [Discuss-gnuradio] Custom GRC block not accepting derived class objects |
Date: | Mon, 23 Feb 2015 10:30:03 -0500 |
I'm hoping for suggestions from the GRC and swig savvy folks on the list.
I am trying to add LDPC functionality to gr-fec [1]. I made a GRC block for a decoder class. The decoder class constructor accepts a base class called fec_mtrx. In GRC, I am trying to give the decoder block an input of an object of a class derived from fec_mtrx, called ldpc_R_U_mtrx. The issue is that swig is giving an error that it expects the base class as the argument.
>From the swig documentation, this type of inheritance and type checking seems to be fully supported and handled by swig. Is there something else I need to consider in either the block's cheetah template for the make call, or the swig files?
The organization of the classes is like:
class FEC_API ldpc_R_U_mtrx : public fec_mtrx { };
class FEC_API ldpc_bit_flip_decoder_impl : public ldpc_bit_flip_decoder
{
public:
ldpc_bit_flip_decoder_impl(fec_mtrx *mtrx_obj, unsigned int max_iter=100);
}
And then in variable_ldpc_bit_flip_decoder.xml I've got: self.$(id) = $(id) = fec.ldpc_bit_flip_decoder.make($matrix_object, $max_iterations)
In my flowgraph, I provide the decoder block an input of a ldpc_R_U_mtrx variable, and swig throws:
TypeError: in method 'ldpc_bit_flip_decoder_make', argument 1 of type 'gr::fec::code::fec_mtrx *
So to me, it seems like swig is not recognizing that the ldpc_R_U_mtrx class derives from fec_mtrx. Not sure what to do about that except to try and “un-inherit" the classes and overload the decoder constructor...
Thanks for any tips,
tracie
[1] github.com/tracierenea/gnuradio/tree/ldpc_mods
[Prev in Thread] | Current Thread | [Next in Thread] |