[C++-sig] Pyplusplus templates and roadmap

Allen Bierbaum abierbaum at gmail.com
Sun Feb 12 18:04:39 CET 2006


On 2/11/06, Roman Yakovenko <roman.yakovenko at gmail.com> wrote:
> On 2/12/06, Allen Bierbaum <abierbaum at gmail.com> wrote:
> > I finally got back from vacation and had a chance to read through the
> > tutorial.  I now have a better understanding of what you are trying to
> > accomplish and I am able to understand what the examples are trying to
> > do.  I have a few comments:
>
> I am glad, you find my project useful. :-)

It is very useful and very powerful.  But right now that is a two
edged sword.  It is so powerful that it is difficult to understand how
to do simple things.  I agree with the other posters that there should
probably be a "simple" interface available to do simple things.  I
think it would be possible to create an interface layer that looks
similar to the Pyste API and that would allow users to specify only
the basic details of what they want done and then have it handled
behind the scenes.

I need to think about it quite a bit more, but right now I am thinking
of something like:
---------------------------------
py_module = create_module(['header1.h","header2.h"], working_dir,
include_paths, symbols, undef_symbols, gccxml_path)

class1 = py_module.Class("Class1")
class2 = py_module.Class("Class2")
func1 = py_module.Func("func1")

class1.removeMethod("hidden_method")
class1.setCallPolicy("method1", return_by_value)

for name in class2.methodNames():
   if should_be_hidden(name):
      class2.removeMethod(name)

py_module.write_file('bindings.cpp')
py_module.write_multiple_files('.')
-----------------------------------

The key ideas of this interface are:
- Use helper classes to wrap access/finding methods and classes in decls
- Create helper methods to accomplish common goals
- Hide decls and filtering inside wrapper classes so users don't need
to understand all the details of what is happening
- Allow access to all details if requested (so we don't lose the power
of pyplusplus)

I believe that an interface like this could be expanded upon in the
future to provide a great deal of power while still providing a usable
interface with the simplicity of a domain specific language.  If while
wrapping my current project I find an interface like this to be
helpful I may give a shot at creating this type of wrapper.

>
> > - I think the tutorial should also expose a class.  The first thing I
> > tried to do after reading the tutorial was to expose a class and it
> > did not work.  (I think I need to use either filters or recursive to
> > make it work but I haven't figured that out yet).
>
> There are so many ways to expose class. If you try to expose class, please
> use pyplusplus GUI. It has new functionality - generate pyplusplus code.
> Should be very helpful to you.

This didn't work.  I extended the tutorial code (see attached) and
then used the GUI to generate the generator.  It still only exports
the free function.

>
> > - More extensive reference documentation for the classes/methods in
> > pyplusplus would be very helpful.  As it stands now I have an idea of
> > what I want to do but I don't have a good place to look for
> > documentation that describes how the current methods work.  Even just
> > having a line or two that describes each class and method (similar to
> > what is in some parts of gccxml) would help tremendously.
>
> I am working on it. I will have documentation generated from source.
> I think, that after user understands main concepts of pyplusplus + pygccxml
> it will do the job.

Agreed.  If I may ask what comment format standard are you going to
use?  I have had very limited success extracting "good" comments from
python code in the past and I am interested to learn how other people
are solving this problem.

Thanks,
Allen

>
> > Thanks,
> > Allen
>
> Thanks
>
> --
> Roman Yakovenko
> C++ Python language binding
> http://www.language-binding.net/
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello_world.hpp
Type: application/octet-stream
Size: 503 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060212/e19de2bf/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: advanced_gui.py
Type: text/x-python
Size: 3341 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060212/e19de2bf/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bindings.cpp
Type: text/x-c++src
Size: 447 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060212/e19de2bf/attachment.cpp>


More information about the Cplusplus-sig mailing list