[Ns-developers] NS-3: state of ns-3-pybindgen
Marc Schinnenburg
msg at comnets.rwth-aachen.de
Wed Jan 2 00:19:25 PST 2008
Hi Mathieu,
Mathieu Lacage schrieb:
> hi gustavo,
>
> On Tue, 2008-01-01 at 21:23 +0000, Gustavo Carneiro wrote:
>
>> Still some important things are missing, namely:
>>
>> 1- Parameters default values (but should not be very difficult to
>> implement this);
>> 2- Templated classes in general; -> needed for protocol implementation (
>> e.g. Header classes)
>> 3- Callback<...> in particular; -> needed for working with sockets and
>> tracing (simple scripting needs this)
>> 4- Simulator::Schedule* methods; -> needed for scripting
>>
>> I'd be glad to hear some feedback on the general direction I'm heading.
>
> Could you point me to a sample python program I can look at to get a
> feel for the API ?
I think this is a good example:
http://code.nsnam.org/gjc/ns-3-pybindgen/file/7598937d89d9/examples/udp-echo.py
>
>> As a side note, is there any reason why Simulator::Schedule is not using
>> Callback's as parameters? Because it would be easier to wrap only
>> Callback<> and not Simulator::Schedule as well...
>
> Yes, there is a reason: the argument to Schedule is a fully bound
> functor while a callback is a fully unbound functor. i.e., an EventImpl
> is expected to store internally the set of values to give back to the
> target function. However, binding this part of the API should be really
> easy: it is a matter of implementing a PythonEventImpl subclass of the
> EventImpl base class which implements the Expire method to call back
> into a python class instance which stores the arguments to the target
> function and imvokes the target python function directly. Of course,
> this depends on making the proper Schedule (Ptr<EventImpl> ) methods
> public.
>
>> [1] It should be noted that gccxml from CVS is now based on GCC 4.2, and
>> so parses all C++ code as well as GCC 4.2 itself, including the templated
>> QueryInterface<T>() method.
>
> cool.
>
> Mathieu
Marc
More information about the Ns-developers
mailing list