[PyKDE] SIP and overloaded non-pure virtual functions

Phil Thompson phil at riverbankcomputing.co.uk
Thu May 29 19:57:01 BST 2003


On Thursday 29 May 2003 1:15 am, Paul F. Kunz wrote:
>    In my PlotterBase.zip file I have
>
> class PlotterBase
> {
>
> public:
>
>   PlotterBase ( const std::string & );
>   void setRange ( const std::string &, double, double );
>   virtual void setBinWidth ( const std::string &, double );
>
> In the C++ code there's an implementation that is overridden by a
> number of derived classes of PlotterBase.   The Python user gets his
> handle on them via
>
> class DisplayController
> {
>
> public:
>
>   static DisplayController * instance ();
>   PlotterBase * createDisplay ( const std::string &,
>                                 const NTuple &,
>                                 const std::vector<std::string> & ) const;
>
> Where the Python class will have a pinter to a C++ derived class of
> PlotterBase.
>
> The SIP generated code for setBinWidth member function contains...
>
> 		PlotterBase *sipCpp;
>
> 		if
> (sipParseArgs(&sipArgsParsed,sipArgs,"mM1d",sipThisObj,sipClass_PlotterBase
>,&sipCpp,sipConvertTo_std_string,&a0,&a0IsTemp,&a1)) {
> 			Py_BEGIN_ALLOW_THREADS
> 			sipCpp -> PlotterBase::setBinWidth(*a0,a1);
> 			Py_END_ALLOW_THREADS
>
> The C++ call to setBinWidth is scoped, the the virtual function table
> of the derived class is not used.
>
>    Is this a know bug in SIP code generation?

No, that's what it is supposed to be. Deciding which is the right 
implementation of setBinWidth() to call happens ealier on in the process.

Phil




More information about the PyQt mailing list