[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-cpp-sig
Subject:    [C++-sig] how to wrap a typedef std::list in boostPython?
From:       rwgk () yahoo ! com (Ralf W !  Grosse-Kunstleve)
Date:       2004-09-17 13:10:02
Message-ID: 20040917110958.9059.qmail () web20228 ! mail ! yahoo ! com
[Download RAW message or body]

--- brett hartshorn <bhartsho@yahoo.com> wrote:

> Hi,
> 
> I am having some problems wrapping a typedef std::list in boostpython.  Here
> is my code:
> 
> typedef std::list< osg::ref_ptr<osgGA::GUIEventHandler> > EventHandlerList;
> 
> and the wrapper:
> 
>     class_<osgProducer::Viewer::EventHandlerList>("EventHandlerList")
> 	.def("push_back", &osgProducer::Viewer::EventHandlerList::push_back)
> 	.def("push_front", &osgProducer::Viewer::EventHandlerList::push_front)
> 	.def("__iter__", iterator<osgProducer::Viewer::EventHandlerList>())
> 	;
> 
> the error that python reports when trying to use the push_front function.
> 
> Traceback (most recent call last):
>   File "./osgkeyboard.py", line 385, in ?
>     main(sys.argv)
>   File "./osgkeyboard.py", line 358, in main
>     viewer.getEventHandlerList().push_front(osgGA.GUIEventHandler())
> Boost.Python.ArgumentError: Python argument types in
>     EventHandlerList.push_front(EventHandlerList, GUIEventHandler)
> did not match C++ signature:
>     push_front(std::list<osg::ref_ptr<osgGA::GUIEventHandler>,
> std::allocator<osg::ref_ptr<osgGA::GUIEventHandler> > > {lvalue},
> osg::ref_ptr<osgGA::GUIEventHandler>)

The element type of your std::list<> template instantiation is:

osg::ref_ptr<osgGA::GUIEventHandler>

What is osg::ref_ptr<>? How did you wrap osgGA::GUIEventHandler? Somehow you
have to tell Boost.Python how to extract a osgGA::GUIEventHandler from a
osg::ref_ptr<osgGA::GUIEventHandler>.

Ralf



		
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic