Re: [pygccxml-development] Using pyplusplus with indexing suite
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2006-05-17 05:05:31
|
On 5/17/06, Allen Bierbaum <al...@vr...> wrote: > I have a function class method that I am trying to wrap with pyplusplus. > > The method is similar to: > > std::vector< boost::shared_ptr< ClassA > > MyClass::getData(); > > I would like to use the indexing suite or something similar to make it > possible to iterate over and use this list from python. Is there any > support for this directly in pyplusplus or can anyone tell me what I > need to do custom to allow this? There are 2 ways to solve the problem. I will not like both of them. 1. Add custom code to class A: class_<std::vector< boost::shared_ptr<A> > >("AVec") .def(vector_indexing_suite<std::vector< std::vector< boost::shared_ptr<A> > > >()) ; And then from Python create a reference from global scope to it: AVec =3D A.AVec http://boost.org/libs/python/doc/v2/indexing.html 2. I will accept the patch. Now when I think about it, it should be fairly simple. 1. There is a need for vector_indexing_suite_ code creator. 2. After this small modification should be done to types_database_t. It should recognize, that data type is vector or map. pygccxml.declarations.templates parser will do the job easier 3. Modify module_creator.creator_t class I am running out of time, otherwise I would implement the patch by myself. I think it should take like 3-5 hours. --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |