[Ns-bugs] [Bug 155] New: "std::ostream & os" parameters not Python friendly

bugzilla-daemon@nsnam-www.ece.gatech.edu bugzilla-daemon at nsnam-www.ece.gatech.edu
Sat Mar 29 15:21:48 PDT 2008


http://www.nsnam.org/bugzilla/show_bug.cgi?id=155

           Summary: "std::ostream & os" parameters not Python friendly
           Product: ns-3
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P3
         Component: simulation core
        AssignedTo: ns-bugs at isi.edu
        ReportedBy: gjcarneiro at gmail.com


In the Python bindings I'm working on
(http://code.nsnam.org/gjc/ns-3-pybindgen-notracing/), I am getting errors
like:

/home/gjc/projects/ns-3/ns-3-pybindgen-notracing/build/debug/ns3/csma-helper.h:68:
Warning: Parameter '::std::ostream & os' error (used in static void
ns3::CsmaHelper::EnableAscii(std::ostream & os, uint32_t nodeid, uint32_t
deviceid) [member function]): TypeLookupError('std::ostream &',)

So, std::ostream is not being wrapped, but the problem is that I am not
comfortable wrapping ostream in any form.  The main problem is passing as
reference and lack of reference counting.

Conceptually, I could create my own PyOStream C++ subclass of ostream, which
would redirect writes to a python file-like object.  But passing as reference
or pointer is dangerous because there is no guarantee that python object will
be kept alive for long.  Python users should not have to worry about life cycle
issues that much, and they are not used to it.

If these NS-3 APIs operated on a reference counted object instead (e.g.
Ptr<OStream>) things would be vastly safer to Python bindings... this
Ptr<OStream> could have "std::ostream& GetStdOStream ()" method.  That would be
fine as long as the std::ostream object life cycle management responsibility
shifts away from the Python bindings into the NS-3 core itself.


-- 
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Ns-bugs mailing list