[C++-sig] Py++: ArgumentError during calling a function of base clas
Anand, Kumar
kanand at qualcomm.com
Fri Jul 20 02:46:06 CEST 2007
Hi,
I have been getting errors like this: Any idea why this is happening and
how to debug it further? 'evTest' is a class that definitely derives
from OMEvent and the relationship has been exposed to Python as well:
ArgumentError: Python argument types in
OMEvent.getSynchronous(evTest)
did not match C++ signature:
getSynchronous(OMEvent {lvalue})
The complete code is as follows:
-----------------------------------------------------------
C++ code:
//abstract class. all functions are pure virtual
class IOxfEvent {
virtual bool getSynchronous() const=0;
};
//abstract class. all functions are pure virtual
class IOxfTimeout : public IOxfEvent {
//other pure virtual functions
};
//concrete class but an object of this class is never created.
//provides default implementation of the interfaces listed above
class OMEvent : public IOxfTimeout {
bool getSynchronous() const;
};
//final concrete class
class evTest : public OMEvent {
};
------------------------------------------------------------------------
Boost Python bindings:
bp::class_< IOxfEvent, std::auto_ptr<IOxfEvent>, boost::noncopyable >(
"IOxfEvent", bp::no_init )
.def("getId", &IOxfEvent::getId)
.def("isTypeOf", &IOxfEvent::isTypeOf);
typedef bp::class_< IOxfTimeout, bp::bases< IOxfEvent >,
std::auto_ptr<IOxfTimeout> , boost::noncopyable > IOxfTimeout_exposer_t;
IOxfTimeout_exposer_t IOxfTimeout_exposer = IOxfTimeout_exposer_t(
"IOxfTimeout", bp::no_init );
IOxfTimeout_exposer.def("getDelayTime", &IOxfTimeout::getDelayTime);
bp::class_< OMEvent, bp::bases< IOxfTimeout >,
std::auto_ptr<OMEvent> >( "OMEvent", bp::init< bp::optional< short int,
IOxfReactive * > >(( bp::arg("eventId")=(short int)(0),
bp::arg("dest")=bp::object() )) )
.def("getSynchronous", &OMEvent::getSynchronous);
//evTest is exposed to python using Py++. I am pasting only the
relevant code.
struct evTest_wrapper : evTest, bp::wrapper< evTest > {
};
typedef bp::class_< evTest_wrapper, bp::bases< OMEvent >,
std::auto_ptr<evTest> > evTest_exposer_t;
------------------------------------------------------------------------
Thanks
Kumar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070719/b2262db3/attachment.htm>
More information about the Cplusplus-sig
mailing list