Re: [pygccxml-development] Querying subclasses of some class?
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2008-10-27 12:33:15
|
On Mon, Oct 27, 2008 at 12:38 PM, Paul Melis <pa...@sc...> wrote: > Hi, > > I want to set a return policy for a whole set of class methods. > This set consists of all methods returning a pointer to some class A > *or one of its subclasses*. > > I don't think I can directly accomplish this using > member_functions(return_value='A *'), as this doesn't seem to match the > subclasses. One way I can probably make this work is if I can iterate > over the subclasses of A and then do a member_functions() call > for the subclass pointer type, followed by setting the return policy. > > Is there a way with pygccxml/Py++ to get a list of subclasses of > some class A? Yes. pygccxml and Py++ provides the functionality you need: * http://language-binding.net/pyplusplus/documentation/apidocs/pygccxml.declarations.type_traits-pysrc.html#is_base_and_derived take a look on is_based_and_derived. pygccxml implements\mimics almost all type traits found in Boost.TypeTraits library * use class_t.recursive_derived property to get list of all classes, which derives from "self" class. HTH -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |