[C++-sig] wrapping an abstract class with out parameters using boost.python
Guillaume Desticourt
guillaume.desticourt at gmail.com
Tue Apr 11 18:07:34 CEST 2006
hello,
i try to wrap an abstract class so i can create class that inherit from it
in python
but at run time i got the following error message:
RuntimeError: extension class wrapper for base class
pimp::gfx2d::DisplayData has not been created yet
my class is something like that:
class DisplayData : public IdData, public LoadData, public
Subject<DisplayData>
{
public:
virtual void accept(DisplayDataVisitor &visitor) = 0;
virtual void getZone(Zone &zone, long time) const = 0;
// ...
}
so i wrote a class:
class DisplayDataWrap :
public DisplayData,
public wrapper<DisplayData>;
to encapsulate the DisplayData::accept, i ve defined:
void DisplayDataWrap::accept(DisplayDataVisitor &visitor)
{
this->get_override("accept")(visitor);
}
and in the module definition i do:
class_<DisplayDataWrap, boost::noncopyable>("PyDisplayData", no_init)
.def("accept", pure_virtual(&DisplayData::accept))
;
the problem is that i have no idea how to encapsulate:
the DisplaData::getZone method...
i tried
Zone getZone(void) const
{
Zone zone;
this->get_override("getZone")(zone);
return zone;
}
Zone (DisplayDataWrap::*getZone1)(void) const = &DisplayDataWrap::getZone;
class_<DisplayDataWrap, boost::noncopyable>("PyDisplayData", no_init)
.def("getZone", getZone1) ;
and then i get the error messge
RuntimeError: extension class wrapper for base class
pimp::gfx2d::DisplayData has not been created yet
and i am not even sure i ll be able to override the getZone in python...
any help would be appreciated, thanks.
--
Guillaume Desticourt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060411/65d14232/attachment.htm>
More information about the Cplusplus-sig
mailing list