Bugzilla – Bug 1037
no way to associate std::cout with OutputStreamWrapper
Last modified: 2011-07-06 18:22:28 UTC
This used to be possible until the patches to bugs 931 and 933 were merged that removed the SetStream() method: Ptr<OutputStreamWrapper> cout_wrap = new OutputStreamWrapper; cout_wrap->SetStream(&std::cout); p2p.EnableAsciiAll (cout_wrap); Currently, there does not appear to be an easy way to redirect tracing to standard output streams. It seems that restoring SetStream() as before leads to memory management ambiguity of the pointer. Can this functionality be re-enabled somehow? (to allow easier post-processing of the trace file in parallel with running simulation)
One alternative to the SetStream function might be add a function to AsciiTraceHelper which returns Ptr<OutputStreamWrapper> directed to standard output. This would be sufficient for our (KUs) needs, without allowing the passing of arbitrary streams by the user.
Does this work (without any changes to ns-3-dev)? PointToPointHelper p2p; Ptr<OutputStreamWrapper> osw = Create<OutputStreamWrapper> (&std::cout); p2p.EnableAsciiAll (osw);
(In reply to comment #2) > Does this work (without any changes to ns-3-dev)? > > PointToPointHelper p2p; > Ptr<OutputStreamWrapper> osw = Create<OutputStreamWrapper> (&std::cout); > p2p.EnableAsciiAll (osw); it should work. INVALID.