[PyKDE] A few minor sip issues

Gerard Vermeulen gerard.vermeulen at grenoble.cnrs.fr
Sat Apr 30 12:49:13 BST 2005


On Sat, 30 Apr 2005 10:49:01 +0100
Phil Thompson <phil at riverbankcomputing.co.uk> wrote:

> On Friday 29 April 2005 5:04 am, Gerard Vermeulen wrote:
> > Phil,
> >
> > (1) /Abstract/ and protected pure virtual member functions.  SIP does not
> > recognize a C++ class as abstract which is abstract only because of a
> > **protected** pure virtual member function.  I still need to use the
> > /Abstract/ annotation.
> 
> Which version of SIP? The following...
> 
> %Module t
> 
> class Foo
> {
> protected:
> 	virtual void bar() = 0;
> };
> 
> ...seems to do the right thing with the current snapshot.
>
I am using SIP-4.2.1 and SIP-snapshot-20050424.

Also with SIP-snapshot-20050424 I get from the following SIP specification

//class SoMField: SoField /Abstract/
class SoMField: SoField
{
%TypeHeaderCode
#include <Inventor/fields/SoMField.h>
%End // %TypeHeaderCode

public:
    virtual ~SoMField();
    static SoType getClassTypeId();
    int getNum() const;
    void setNum(const int);
    virtual void deleteValues(int, int = -1);
    virtual void insertSpace(int, int);
    SbBool set1(const int, const char*);
    void get1(const int, SbString&);
    static void initClass();
    virtual void enableDeleteValues();
    virtual SbBool isDeleteValuesEnabled();
protected:
    SoMField();
    virtual void makeRoom(int);
    virtual int fieldSizeof() const = 0;
    virtual void* valuesPtr() = 0;
    virtual void setValuesPtr(void*) = 0;
    virtual void allocValues(int);
}; // class SoMField

the following compiler errors:

g++ -c -pipe -fPIC -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -Wall -W -D_REENTRANT -DHAS_NUMERIC2 -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -I. -I/usr/include -I/home/packer/usr/include/python2.4 -I/usr/lib/qt3//include -I/usr/X11R6/include -o sipcoin3dpart0.o sipcoin3dpart0.cpp
sipcoin3dpart0.cpp: In function `void* init_SoMField(sipWrapper*, PyObject*, int*)':
sipcoin3dpart0.cpp:315645: error: cannot allocate an object of type `sipSoMField'
sipcoin3dpart0.cpp:315645: error:   because the following virtual functions are abstract:
/usr/include/Inventor/fields/SoMField.h:70: error:      virtual void SoMField::deleteAllValues()
/usr/include/Inventor/fields/SoMField.h:71: error:      virtual void SoMField::copyValue(int, int)
/usr/include/Inventor/fields/SoMField.h:73: error:      virtual SbBool SoMField::read1Value(SoInput*, int)
/usr/include/Inventor/fields/SoMField.h:75: error:      virtual void SoMField::write1Value(SoOutput*, int) const
sipcoin3dpart0.cpp:315655: error: cannot allocate an object of type `sipSoMField'
sipcoin3dpart0.cpp:315655: error:   since type `sipSoMField' has abstract virtual functions
make[1]: *** [sipcoin3dpart0.o] Error 1
make[1]: Leaving directory `/home/packer/BUILD/Coin4PyQt-0.1/configure/coin3d'
make: *** [install] Error 2

I have to say that SoMField's base class SoField is abstract (it has protected and
public pure virtual member functions).  However, the pure virtual protected
member functions in SoMField do not occur in SoField at all. 

Gerard





More information about the PyQt mailing list