Re: [pygccxml-development] argument policies
Brought to you by:
mbaas,
roman_yakovenko
|
From: Roman Y. <rom...@gm...> - 2006-05-03 05:36:14
|
On 5/2/06, Neal Becker <ndb...@gm...> wrote:
> Personally, I don't need argument policies much. The one I do need is:
>
> typedef boost::mt19937 rng_t;
> class_<WrappedClass> (python_typename, desc,
> python::init<rng_t&, double>((python::arg("rng"),=
python::arg("var")),
> "__init__(r,var)\n"
> "Construct a normal =
deviate generator\n"
> "@param r: Mersenne =
Twister\n"
> "@type r: L{rng}\n"
> "@param var: varianc=
e\n"
> "@type var: float\n"
> )
> [python::with_custodian_and_ward<1,2>()])
>
> Here, rng_t is boost::mersenne_twister. The wrapped object needs to hold=
a
> reference to a rng_t object, so we need "with_custodian_and_ward".
mb =3D module_builder_t( ... )
wc_constructor \
=3D mb.constructor( name=3D"WrappedClass", arg_types=3D[None, 'double'] )
#None is used as any type, size of arg_types list used to indicate the
#number of function arguments
wc_constructor =3D module_builder.call_policies.with_custodian_and_ward()
P.S. I also creates wrapper for boost.random library. I think I will
have it ready
in week or two. Also I will expose another boost libraries.
So if you want to join efforts you are welcome.
Here http://tinyurl.com/m5puo you can find my initial script.
Roman
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|