1.1 --- a/examples/routing/manet-routing-compare.cc Thu Sep 27 13:29:03 2012 -0400
1.2 +++ b/examples/routing/manet-routing-compare.cc Fri Sep 28 12:22:18 2012 -0700
1.3 @@ -378,9 +378,8 @@
1.4 //AsciiTraceHelper ascii;
1.5 //Ptr<OutputStreamWrapper> osw = ascii.CreateFileStream ( (tr_name + ".tr").c_str());
1.6 //wifiPhy.EnableAsciiAll (osw);
1.7 - std::ofstream os;
1.8 - os.open ((tr_name + ".mob").c_str ());
1.9 - MobilityHelper::EnableAsciiAll (os);
1.10 + AsciiTraceHelper ascii;
1.11 + MobilityHelper::EnableAsciiAll (ascii.CreateFileStream (tr_name + ".mob"));
1.12
1.13 //Ptr<FlowMonitor> flowmon;
1.14 //FlowMonitorHelper flowmonHelper;
2.1 --- a/examples/wireless/wifi-wired-bridging.cc Thu Sep 27 13:29:03 2012 -0400
2.2 +++ b/examples/wireless/wifi-wired-bridging.cc Fri Sep 28 12:22:18 2012 -0700
2.3 @@ -190,9 +190,8 @@
2.4
2.5 if (writeMobility)
2.6 {
2.7 - std::ofstream os;
2.8 - os.open ("wifi-wired-bridging.mob");
2.9 - MobilityHelper::EnableAsciiAll (os);
2.10 + AsciiTraceHelper ascii;
2.11 + MobilityHelper::EnableAsciiAll (ascii.CreateFileStream ("wifi-wired-bridging.mob"));
2.12 }
2.13
2.14 Simulator::Stop (Seconds (5.0));
3.1 --- a/src/mobility/helper/mobility-helper.cc Thu Sep 27 13:29:03 2012 -0400
3.2 +++ b/src/mobility/helper/mobility-helper.cc Fri Sep 28 12:22:18 2012 -0700
3.3 @@ -200,8 +200,9 @@
3.4 }
3.5 }
3.6 void
3.7 -MobilityHelper::CourseChanged (std::ostream *os, Ptr<const MobilityModel> mobility)
3.8 +MobilityHelper::CourseChanged (Ptr<OutputStreamWrapper> stream, Ptr<const MobilityModel> mobility)
3.9 {
3.10 + std::ostream* os = stream->GetStream ();
3.11 Ptr<Node> node = mobility->GetObject<Node> ();
3.12 *os << "now=" << Simulator::Now ()
3.13 << " node=" << node->GetId ();
3.14 @@ -225,25 +226,25 @@
3.15 }
3.16
3.17 void
3.18 -MobilityHelper::EnableAscii (std::ostream &os, uint32_t nodeid)
3.19 +MobilityHelper::EnableAscii (Ptr<OutputStreamWrapper> stream, uint32_t nodeid)
3.20 {
3.21 std::ostringstream oss;
3.22 oss << "/NodeList/" << nodeid << "/$ns3::MobilityModel/CourseChange";
3.23 Config::ConnectWithoutContext (oss.str (),
3.24 - MakeBoundCallback (&MobilityHelper::CourseChanged, &os));
3.25 + MakeBoundCallback (&MobilityHelper::CourseChanged, stream));
3.26 }
3.27 void
3.28 -MobilityHelper::EnableAscii (std::ostream &os, NodeContainer n)
3.29 +MobilityHelper::EnableAscii (Ptr<OutputStreamWrapper> stream, NodeContainer n)
3.30 {
3.31 for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
3.32 {
3.33 - EnableAscii (os, (*i)->GetId ());
3.34 + EnableAscii (stream, (*i)->GetId ());
3.35 }
3.36 }
3.37 void
3.38 -MobilityHelper::EnableAsciiAll (std::ostream &os)
3.39 +MobilityHelper::EnableAsciiAll (Ptr<OutputStreamWrapper> stream)
3.40 {
3.41 - EnableAscii (os, NodeContainer::GetGlobal ());
3.42 + EnableAscii (stream, NodeContainer::GetGlobal ());
3.43 }
3.44 int64_t
3.45 MobilityHelper::AssignStreams (NodeContainer c, int64_t stream)
4.1 --- a/src/mobility/helper/mobility-helper.h Thu Sep 27 13:29:03 2012 -0400
4.2 +++ b/src/mobility/helper/mobility-helper.h Fri Sep 28 12:22:18 2012 -0700
4.3 @@ -24,6 +24,7 @@
4.4 #include <vector>
4.5 #include "ns3/object-factory.h"
4.6 #include "ns3/attribute.h"
4.7 +#include "ns3/output-stream-wrapper.h"
4.8 #include "ns3/position-allocator.h"
4.9 #include "node-container.h"
4.10
4.11 @@ -221,31 +222,31 @@
4.12 void InstallAll (void);
4.13
4.14 /**
4.15 - * \param os output stream
4.16 + * \param stream an output stream wrapper
4.17 * \param nodeid the id of the node to generate ascii output for.
4.18 *
4.19 * Enable ascii output on the mobility model associated to the
4.20 * specified nodeid and dump that to the specified stdc++ output
4.21 * stream.
4.22 */
4.23 - static void EnableAscii (std::ostream &os, uint32_t nodeid);
4.24 + static void EnableAscii (Ptr<OutputStreamWrapper> stream, uint32_t nodeid);
4.25 /**
4.26 - * \param os output stream
4.27 + * \param stream an output stream wrapper
4.28 * \param n node container
4.29 *
4.30 * Enable ascii output on the mobility model associated each of
4.31 * the nodes in the input container and dump that to the
4.32 * specified stdc++ output stream.
4.33 */
4.34 - static void EnableAscii (std::ostream &os, NodeContainer n);
4.35 + static void EnableAscii (Ptr<OutputStreamWrapper> stream, NodeContainer n);
4.36 /**
4.37 - * \param os output stream
4.38 + * \param stream an output stream wrapper
4.39 *
4.40 * Enable ascii output on the mobility model associated
4.41 * every node in the system and dump that to the specified
4.42 * stdc++ output stream.
4.43 */
4.44 - static void EnableAsciiAll (std::ostream &os);
4.45 + static void EnableAsciiAll (Ptr<OutputStreamWrapper> stream);
4.46 /**
4.47 * Assign a fixed random variable stream number to the random variables
4.48 * used by the mobility models (including any position allocators assigned
4.49 @@ -264,7 +265,7 @@
4.50 /**
4.51 * \internal
4.52 */
4.53 - static void CourseChanged (std::ostream *os, Ptr<const MobilityModel> mobility);
4.54 + static void CourseChanged (Ptr<OutputStreamWrapper> stream, Ptr<const MobilityModel> mobility);
4.55 std::vector<Ptr<MobilityModel> > m_mobilityStack;
4.56 ObjectFactory m_mobility;
4.57 Ptr<PositionAllocator> m_position;