Bug 1037 - no way to associate std::cout with OutputStreamWrapper
no way to associate std::cout with OutputStreamWrapper
Status: RESOLVED INVALID
Product: ns-3
Classification: Unclassified
Component: core
pre-release
All All
: P5 normal
Assigned To: Mathieu Lacage
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-12-08 17:44 UTC by Tom Henderson
Modified: 2011-07-06 18:22 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Henderson 2010-12-08 17:44:02 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)
Comment 1 Justin P. Rohrer 2010-12-08 18:05:45 UTC
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.
Comment 2 Tom Henderson 2010-12-29 12:55:22 UTC
Does this work (without any changes to ns-3-dev)?

   PointToPointHelper p2p;
   Ptr<OutputStreamWrapper> osw = Create<OutputStreamWrapper> (&std::cout);
   p2p.EnableAsciiAll (osw);
Comment 3 Mathieu Lacage 2011-07-06 18:22:28 UTC
(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.