[Ns-developers] NS-3 Python

Gustavo Carneiro gjcarneiro at gmail.com
Fri Jan 18 10:34:05 PST 2008


On 18/01/2008, Mathieu Lacage <mathieu.lacage at sophia.inria.fr> wrote:
>
> On Fri, 2008-01-18 at 17:31 +0000, Gustavo Carneiro wrote:
>
> >    1- not all of the NS-3 API is covered, of course; that will take time
> and
> > patience;
> >
> >    2- to generate the python bindings special tools are required
> (gccxml,
> > pygccxml, pybindgen):
> >
> >       a) pregenerated python bindings can be included in releases (no
> code
> > generation needed, only compilation);
> >
> >       b) developers checking out from code.nsnam.org will need to have
> the
> > needed tools to generate python bindings;
> >
> >       c) users/developers that want to modify the NS-3 API from a
> release
> > tarball will have to have the tools to regenerate the python binding
> code
> > (or else modify the code manually), otherwise the bindings may of course
> > stop compiling.
> >
> > Comments/objections?
>
> Yes, my main question is:
>   - as a developer, what do I have to do to bind new models I add to
> ns-3 ?


Just install the needed tools.

Bindings are generated for all 'public' ns-3 header files.  PyBindGen will
pick up the new APIs and hopefully wrap them, unless there are weird things
like templates methods/functions, or pointers to objects (smart pointers are
ok).  But I have tried to be very careful in PyBindGen in that it tries very
hard to make the code always compilable (e.g. if a class is missing pure
virtual method implementation then do not every try to instantiate it, even
if the wrapper is not generated).

  - as a developer, what do I have to do to make sure that I do not
> break the bindings if I change the ns-3 API ?


 If you do not have the tools and break the ns-3 API, then the bindings will
not compile.  I'm not sure if there's anything that can be done about this,
but ideas are welcome.

 If you have the tools then the bindings will be regenerated and adapt.

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list