[C++-sig] Py++ issues, plus switching from Swig

Roman Yakovenko roman.yakovenko at gmail.com
Thu Aug 31 12:17:29 CEST 2006


On 8/31/06, wz <wz_ at gmx.net> wrote:
> Those links were indeed helpful, especially the sizeof() method once again
> shows
> that beauty is in simplicity.
>
> Still, my concerns are not completely vanished.
>
> 1) If I understood it right, in order to make my instanciated vector<float>
>     named vector_Float in python, do I have to use this construct:
>         typedef vector<float> vector_Float; sizeof(vector_Float);
>     ? Is there a better way that would not let me write out all 1000s of
> templates
>     possibilities from over 250 included headers? A simple
>         mb.collect_templates('vector', ['float', 'bool', 'Point3',
> 'Quaternion'])
>     would be a godsend.

Take a look on contrib package. It contains class that may be does what you
want.  Before you go with this solution consider to read "best practices"
http://language-binding.net/pyplusplus/documentation/best_practices.html

You may have performance problems, Py++ will have to work on a huge amount
of data ( in your case ).

> 2) How to deal with templated functions? As there are at least one
> DynamicCast<T>
>     and one StaticCast<T> for each class, how can I automate their use in
> Py++?

I don't understand this part of question

> As said, I cannot manually make C++ instantiations of the classes. They
> change too
> frequently, and I could not catch up to their rate of change.

GCCXML does not dump template classes, but thier instantiation.
So, somewhere you will have to keep a matrix of template classes and thier
possible ( arguments )instantiations. I don't see how you can avoid this.

In some cases it is possible to reuse coding conventions, physical and logical
designs. For example directory A contains  template classes, while directory
B contains class-arguments to classes defined in A.  Something like this.

May be you can run Py++ on user code, so you will have all instantiations that
users use?

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list