[C++-sig] C++ compile error on .def from n00b.
Randy Taylor
Randy.Taylor at TradingTechnologies.com
Fri Mar 31 08:46:01 CEST 2006
I'm a n00b.
I'm trying to expose a C++ class that has a virtual mem fun with an
implementation that I wish to override in Python. Seems easy enough.
Compiler disagrees, saying she does not like my def. I must be doing something
wrong. What is it? Thanks kindly in advance.
Here's my Wrapper:
struct ListenerWrap : tt_stream_ns::VIAmCallback,
python::wrapper<tt_stream_ns::VIAmCallback>
{
virtual void OnData(tt_stream_ns::VIAmSession *sess,
const tt_stream_ns::VIAmSubject& subj,
tt_stream_ns::VIAmSender *sender,
tt_stream_ns::Streamable& obj,
tt_stream_ns::VIAmListener *listener)
{
if (python::override the_override = this->get_override("OnData")) {
the_override(sess,subj,sender,obj,listener); // *note*
return;
}
tt_stream_ns::VIAmCallback::OnData(sess,subj,sender,obj,listener);
}
void default_OnData(tt_stream_ns::VIAmSession *sess,
const tt_stream_ns::VIAmSubject& subj,
tt_stream_ns::VIAmSender *sender,
tt_stream_ns::Streamable& obj,
tt_stream_ns::VIAmListener *listener)
{
this->tt_stream_ns::VIAmCallback::OnData
(sess,subj,sender,obj,listener);
}
};
And my def:
BOOST_PYTHON_MODULE(pycore)
{
python::class_<ListenerWrap, boost::noncopyable>("VIAmCallback")
.def("OnData"
,&tt_stream_ns::VIAmCallback::OnData
,&ListenerWrap::default_OnData
);
}
And here's her complaint:
c:\shi_zero_go\core\api\7_0\dev\pycore\pycore.cpp(81) : error
C2780: 'boost::python::class_<W,X1>::self &boost::python::class_<W,X1>::def
(const char *,Fn,const A1 &,const A2 &,const A3 &)' : expects 5 arguments - 3
provided
with
[
W=ListenerWrap,
X1=boost::noncopyable
]
c:\shi_zero_go\misc\boost\1_32_0\dev\boost\python\class.hpp(265) : see
declaration of 'boost::python::class_<W,X1>::def'
with
[
W=ListenerWrap,
X1=boost::noncopyable
]
c:\shi_zero_go\core\api\7_0\dev\pycore\pycore.cpp(81) : error
C2780: 'boost::python::class_<W,X1>::self &boost::python::class_<W,X1>::def
(const char *,Fn,const A1 &,const A2 &)' : expects 4 arguments - 3 provided
with
[
W=ListenerWrap,
X1=boost::noncopyable
]
c:\shi_zero_go\misc\boost\1_32_0\dev\boost\python\class.hpp(249) : see
declaration of 'boost::python::class_<W,X1>::def'
with
[
W=ListenerWrap,
X1=boost::noncopyable
]
Thank you!
Randy Taylor
More information about the Cplusplus-sig
mailing list