--- a/doc/tutorial/tracing.texi Fri Feb 12 16:44:15 2010 -0800
+++ b/doc/tutorial/tracing.texi Fri Feb 12 17:31:11 2010 -0800
@@ -1937,7 +1937,7 @@
@verbatim
static void
- CwndChange (Ptr<OutputStreamObject> stream, uint32_t oldCwnd, uint32_t newCwnd)
+ CwndChange (Ptr<OutputStreamKeeper> stream, uint32_t oldCwnd, uint32_t newCwnd)
{
NS_LOG_UNCOND (Simulator::Now ().GetSeconds () << "\t" << newCwnd);
*stream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << oldCwnd << "\t" << newCwnd << std::endl;
@@ -1952,15 +1952,15 @@
@end verbatim
We have added a ``stream'' parameter to the @code{CwndChange} trace sink.
-This is an @code{ns-3} object that holds a C++ output stream. It turns out
-that this is a very simple object, but one that manages lifetime issues for
-the stream and solves a problem that many experienced C++ users run into.
-It turns out that the copy constructor for ostream is marked private. This
-means that ostreams do not obey value semantics and cannot be used in
-any mechanism that requires the stream to be copied. This includes the
-callback system, which as you may recall, requires objects that obey value
-semantics. Further notice that we have added the following line in the
-@code{CwndChange} trace sink implementation:
+This is an object that holds (keeps safely alive) a C++ output stream. It
+turns out that this is a very simple object, but one that manages lifetime
+issues for the stream and solves a problem that even experienced C++ users
+run into. It turns out that the copy constructor for ostream is marked
+private. This means that ostreams do not obey value semantics and cannot
+be used in any mechanism that requires the stream to be copied. This includes
+the @command{ns-3} callback system, which as you may recall, requires objects
+that obey value semantics. Further notice that we have added the following
+line in the @code{CwndChange} trace sink implementation:
@verbatim
*stream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << oldCwnd << "\t" << newCwnd << std::endl;
@@ -1973,7 +1973,7 @@
std::cout << Simulator::Now ().GetSeconds () << "\t" << oldCwnd << "\t" << newCwnd << std::endl;
@end verbatim
-This illustrates that the @code{Ptr<OutputStreamObject>} is really just
+This illustrates that the @code{Ptr<OutputStreamKeeper>} is really just
carrying around a @code{std::ofstream} for you, and you can use it here like
any other output stream.
@@ -1992,7 +1992,7 @@
@verbatim
AsciiTraceHelper asciiTraceHelper;
- Ptr<OutputStreamObject> stream = asciiTraceHelper.CreateFileStream ("sixth.cwnd");
+ Ptr<OutputStreamKeeper> stream = asciiTraceHelper.CreateFileStream ("sixth.cwnd");
ns3TcpSocket->TraceConnectWithoutContext ("CongestionWindow", MakeBoundCallback (&CwndChange, stream));
...
@@ -2023,7 +2023,7 @@
source to add the additional ``stream'' parameter to the front of the formal
parameter list before invoking the callback. This changes the required
signature of the @code{CwndChange} sink to match the one shown above, which
-includes the ``extra'' parameter @code{Ptr<OutputStreamObject> stream}.
+includes the ``extra'' parameter @code{Ptr<OutputStreamKeeper> stream}.
In the second section of code in the snippet above, we instantiate a
@code{PcapHelper} to do the same thing for our pcap trace file that we did
@@ -2049,7 +2049,45 @@
A @code{ns-3} object representing the pcap file is returned from @code{CreateFile}
and used in a bound callback exactly as it was in the ascii case.
-If you now build and run this example,
+An important detour: It is important to notice that even though both of these
+objects are declared in very similar ways,
+
+@verbatim
+ Ptr<PcapFileObject> file ...
+ Ptr<OutputStreamKeeper> stream ...
+@end verbatim
+
+The underlying objects are entirely different. For example, the
+Ptr<PcapFileObject> is a smart pointer to an @command{ns-3} Object that is a
+fairly heaviweight thing that supports @code{Attributes} and is integrated into
+the config system. The Ptr<OutputStreamKeeper>, on the other hand, is a smart
+pointer to a reference counted object that is a very lightweight thing.
+Remember to always look at the object you are referencing before making any
+assumptions about the ``powers'' that object may have.
+
+For example, take a look at @code{src/common/pcap-file-object.h} in the
+distribution and notice,
+
+@verbatim
+ class PcapFileObject : public Object
+@end verbatim
+
+that class @code{PcapFileObject} is an @command{ns-3} Object by virtue of
+its inheritance. Then look at @code{src/common/output-stream-keeper.h} and
+notice,
+
+@verbatim
+ class OutputStreamKeeper : public SimpleRefCount<OutputStreamKeeper>
+@end verbatim
+
+that this object is not an @command{ns-3} Object at all, it is ``merely'' a
+C++ object that happens to support intrusive reference counting.
+
+The point here is that just because you read Ptr<something> it does not necessarily
+mean that ``something'' is an @command{ns-3} Object on which you can hang @command{ns-3}
+@code{Attributes}, for example.
+
+Now, back to the example. If you now build and run this example,
@verbatim
./waf --run sixth
@@ -2100,7 +2138,7 @@
@verbatim
static void
- CwndChange (Ptr<OutputStreamObject> stream, uint32_t oldCwnd, uint32_t newCwnd)
+ CwndChange (Ptr<OutputStreamKeeper> stream, uint32_t oldCwnd, uint32_t newCwnd)
{
NS_LOG_UNCOND (Simulator::Now ().GetSeconds () << "\t" << newCwnd);
*stream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << oldCwnd << "\t" << newCwnd << std::endl;
@@ -2109,7 +2147,7 @@
...
AsciiTraceHelper asciiTraceHelper;
- Ptr<OutputStreamObject> stream = asciiTraceHelper.CreateFileStream ("sixth.cwnd");
+ Ptr<OutputStreamKeeper> stream = asciiTraceHelper.CreateFileStream ("sixth.cwnd");
ns3TcpSocket->TraceConnectWithoutContext ("CongestionWindow", MakeBoundCallback (&CwndChange, stream));
...
@@ -2352,7 +2390,7 @@
to this class.
@verbatim
- virtual void EnableAsciiInternal (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<NetDevice> nd) = 0;
+ virtual void EnableAsciiInternal (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<NetDevice> nd) = 0;
@end verbatim
The signature of this method reflects the device-centric view of the situation
@@ -2364,7 +2402,7 @@
@verbatim
void EnableAscii (std::string prefix, Ptr<NetDevice> nd);
- void EnableAscii (Ptr<OutputStreamObject> stream, Ptr<NetDevice> nd);
+ void EnableAscii (Ptr<OutputStreamKeeper> stream, Ptr<NetDevice> nd);
@verbatim
will call the device implementation of @code{EnableAsciiInternal} directly,
@@ -2379,22 +2417,22 @@
@verbatim
void EnableAscii (std::string prefix, Ptr<NetDevice> nd);
- void EnableAscii (Ptr<OutputStreamObject> stream, Ptr<NetDevice> nd);
+ void EnableAscii (Ptr<OutputStreamKeeper> stream, Ptr<NetDevice> nd);
void EnableAscii (std::string prefix, std::string ndName);
- void EnableAscii (Ptr<OutputStreamObject> stream, std::string ndName);
+ void EnableAscii (Ptr<OutputStreamKeeper> stream, std::string ndName);
void EnableAscii (std::string prefix, NetDeviceContainer d);
- void EnableAscii (Ptr<OutputStreamObject> stream, NetDeviceContainer d);
+ void EnableAscii (Ptr<OutputStreamKeeper> stream, NetDeviceContainer d);
void EnableAscii (std::string prefix, NodeContainer n);
- void EnableAscii (Ptr<OutputStreamObject> stream, NodeContainer n);
+ void EnableAscii (Ptr<OutputStreamKeeper> stream, NodeContainer n);
void EnableAscii (std::string prefix, uint32_t nodeid, uint32_t deviceid);
- void EnableAscii (Ptr<OutputStreamObject> stream, uint32_t nodeid, uint32_t deviceid);
+ void EnableAscii (Ptr<OutputStreamKeeper> stream, uint32_t nodeid, uint32_t deviceid);
void EnableAsciiAll (std::string prefix);
- void EnableAsciiAll (Ptr<OutputStreamObject> stream);
+ void EnableAsciiAll (Ptr<OutputStreamKeeper> stream);
@end verbatim
You are encouraged to peruse the Doxygen for class @code{TraceHelperForDevice}
@@ -2433,7 +2471,7 @@
Ptr<NetDevice> nd1;
Ptr<NetDevice> nd2;
...
- Ptr<OutputStreamObject> stream = asciiTraceHelper.CreateFileStream ("trace-file-name.tr");
+ Ptr<OutputStreamKeeper> stream = asciiTraceHelper.CreateFileStream ("trace-file-name.tr");
...
helper.EnableAscii (stream, nd1);
helper.EnableAscii (stream, nd2);
@@ -2462,7 +2500,7 @@
This would result in two files named ``prefix-client-eth0.tr'' and
``prefix-server-eth0.tr'' with traces for each device in the respective trace
-file. Since all of the EnableAscii functions are overloaded to take a stream object,
+file. Since all of the EnableAscii functions are overloaded to take a stream keeper,
you can use that form as well:
@verbatim
@@ -2471,7 +2509,7 @@
Names::Add ("server" ...);
Names::Add ("server/eth0" ...);
...
- Ptr<OutputStreamObject> stream = asciiTraceHelper.CreateFileStream ("trace-file-name.tr");
+ Ptr<OutputStreamKeeper> stream = asciiTraceHelper.CreateFileStream ("trace-file-name.tr");
...
helper.EnableAscii (stream, "client/eth0");
helper.EnableAscii (stream, "server/eth0");
@@ -2501,7 +2539,7 @@
@verbatim
NetDeviceContainer d = ...;
...
- Ptr<OutputStreamObject> stream = asciiTraceHelper.CreateFileStream ("trace-file-name.tr");
+ Ptr<OutputStreamKeeper> stream = asciiTraceHelper.CreateFileStream ("trace-file-name.tr");
...
helper.EnableAscii (stream, d);
@end verbatim
@@ -2737,7 +2775,7 @@
additionally implement a single virtual method inherited from this class.
@verbatim
- virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamObject> stream, std::string prefix,
+ virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamKeeper> stream, std::string prefix,
Ptr<Ipv4> ipv4, uint32_t interface) = 0;
@end verbatim
@@ -2750,7 +2788,7 @@
@verbatim
void EnableAsciiIpv4 (std::string prefix, Ptr<Ipv4> ipv4, uint32_t interface);
- void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, Ptr<Ipv4> ipv4, uint32_t interface);
+ void EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, Ptr<Ipv4> ipv4, uint32_t interface);
@verbatim
will call the device implementation of @code{EnableAsciiIpv4Internal} directly,
@@ -2765,22 +2803,22 @@
@verbatim
void EnableAsciiIpv4 (std::string prefix, Ptr<Ipv4> ipv4, uint32_t interface);
- void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, Ptr<Ipv4> ipv4, uint32_t interface);
+ void EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, Ptr<Ipv4> ipv4, uint32_t interface);
void EnableAsciiIpv4 (std::string prefix, std::string ipv4Name, uint32_t interface);
- void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, std::string ipv4Name, uint32_t interface);
+ void EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, std::string ipv4Name, uint32_t interface);
void EnableAsciiIpv4 (std::string prefix, Ipv4InterfaceContainer c);
- void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, Ipv4InterfaceContainer c);
+ void EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, Ipv4InterfaceContainer c);
void EnableAsciiIpv4 (std::string prefix, NodeContainer n);
- void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, NodeContainer n);
+ void EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, NodeContainer n);
void EnableAsciiIpv4 (std::string prefix, uint32_t nodeid, uint32_t deviceid);
- void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, uint32_t nodeid, uint32_t interface);
+ void EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, uint32_t nodeid, uint32_t interface);
void EnableAsciiIpv4All (std::string prefix);
- void EnableAsciiIpv4All (Ptr<OutputStreamObject> stream);
+ void EnableAsciiIpv4All (Ptr<OutputStreamKeeper> stream);
@end verbatim
You are encouraged to peruse the Doxygen for class @code{PcapAndAsciiHelperForIpv4}
@@ -2819,7 +2857,7 @@
Ptr<Ipv4> protocol1 = node1->GetObject<Ipv4> ();
Ptr<Ipv4> protocol2 = node2->GetObject<Ipv4> ();
...
- Ptr<OutputStreamObject> stream = asciiTraceHelper.CreateFileStream ("trace-file-name.tr");
+ Ptr<OutputStreamKeeper> stream = asciiTraceHelper.CreateFileStream ("trace-file-name.tr");
...
helper.EnableAsciiIpv4 (stream, protocol1, 1);
helper.EnableAsciiIpv4 (stream, protocol2, 1);
@@ -2848,13 +2886,13 @@
This would result in two files named ``prefix-nnode1Ipv4-i1.tr'' and
``prefix-nnode2Ipv4-i1.tr'' with traces for each interface in the respective
trace file. Since all of the EnableAscii functions are overloaded to take a
-stream object, you can use that form as well:
+stream keeper, you can use that form as well:
@verbatim
Names::Add ("node1Ipv4" ...);
Names::Add ("node2Ipv4" ...);
...
- Ptr<OutputStreamObject> stream = asciiTraceHelper.CreateFileStream ("trace-file-name.tr");
+ Ptr<OutputStreamKeeper> stream = asciiTraceHelper.CreateFileStream ("trace-file-name.tr");
...
helper.EnableAsciiIpv4 (stream, "node1Ipv4", 1);
helper.EnableAsciiIpv4 (stream, "node2Ipv4", 1);
@@ -2897,7 +2935,7 @@
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interfaces = ipv4.Assign (devices);
...
- Ptr<OutputStreamObject> stream = asciiTraceHelper.CreateFileStream ("trace-file-name.tr");
+ Ptr<OutputStreamKeeper> stream = asciiTraceHelper.CreateFileStream ("trace-file-name.tr");
...
helper.EnableAsciiIpv4 (stream, interfaces);
@end verbatim
--- a/examples/routing/dynamic-global-routing.cc Fri Feb 12 16:44:15 2010 -0800
+++ b/examples/routing/dynamic-global-routing.cc Fri Feb 12 17:31:11 2010 -0800
@@ -191,7 +191,7 @@
AsciiTraceHelper ascii;
- Ptr<OutputStreamObject> stream = ascii.CreateFileStream ("dynamic-global-routing.tr");
+ Ptr<OutputStreamKeeper> stream = ascii.CreateFileStream ("dynamic-global-routing.tr");
p2p.EnableAsciiAll (stream);
csma.EnableAsciiAll (stream);
internet.EnableAsciiIpv4All (stream);
--- a/examples/routing/mixed-global-routing.cc Fri Feb 12 16:44:15 2010 -0800
+++ b/examples/routing/mixed-global-routing.cc Fri Feb 12 17:31:11 2010 -0800
@@ -121,7 +121,7 @@
apps.Stop (Seconds (10.0));
AsciiTraceHelper ascii;
- Ptr<OutputStreamObject> stream = ascii.CreateFileStream ("mixed-global-routing.tr");
+ Ptr<OutputStreamKeeper> stream = ascii.CreateFileStream ("mixed-global-routing.tr");
p2p.EnableAsciiAll (stream);
csma.EnableAsciiAll (stream);
--- a/examples/tutorial/sixth.cc Fri Feb 12 16:44:15 2010 -0800
+++ b/examples/tutorial/sixth.cc Fri Feb 12 17:31:11 2010 -0800
@@ -161,7 +161,7 @@
}
static void
-CwndChange (Ptr<OutputStreamObject> stream, uint32_t oldCwnd, uint32_t newCwnd)
+CwndChange (Ptr<OutputStreamKeeper> stream, uint32_t oldCwnd, uint32_t newCwnd)
{
NS_LOG_UNCOND (Simulator::Now ().GetSeconds () << "\t" << newCwnd);
*stream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << oldCwnd << "\t" << newCwnd << std::endl;
@@ -215,7 +215,7 @@
app->SetStopTime (Seconds (20.));
AsciiTraceHelper asciiTraceHelper;
- Ptr<OutputStreamObject> stream = asciiTraceHelper.CreateFileStream ("sixth.cwnd");
+ Ptr<OutputStreamKeeper> stream = asciiTraceHelper.CreateFileStream ("sixth.cwnd");
ns3TcpSocket->TraceConnectWithoutContext ("CongestionWindow", MakeBoundCallback (&CwndChange, stream));
PcapHelper pcapHelper;
--- a/examples/wireless/mixed-wireless.cc Fri Feb 12 16:44:15 2010 -0800
+++ b/examples/wireless/mixed-wireless.cc Fri Feb 12 17:31:11 2010 -0800
@@ -389,7 +389,7 @@
// Let's set up some ns-2-like ascii traces, using another helper class
//
AsciiTraceHelper ascii;
- Ptr<OutputStreamObject> stream = ascii.CreateFileStream ("mixed-wireless.tr");
+ Ptr<OutputStreamKeeper> stream = ascii.CreateFileStream ("mixed-wireless.tr");
wifiPhy.EnableAsciiAll (stream);
csma.EnableAsciiAll (stream);
internet.EnableAsciiIpv4All (stream);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/common/output-stream-keeper.cc Fri Feb 12 17:31:11 2010 -0800
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 University of Washington
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "ns3/log.h"
+#include "output-stream-keeper.h"
+
+NS_LOG_COMPONENT_DEFINE ("OutputStreamKeeper");
+
+namespace ns3 {
+
+OutputStreamKeeper::OutputStreamKeeper ()
+ : m_ostream (0)
+{
+}
+
+OutputStreamKeeper::~OutputStreamKeeper ()
+{
+ delete m_ostream;
+ m_ostream = 0;
+}
+
+void
+OutputStreamKeeper::SetStream (std::ostream *ostream)
+{
+ m_ostream = ostream;
+}
+
+std::ostream *
+OutputStreamKeeper::GetStream (void)
+{
+ return m_ostream;
+}
+
+} //namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/common/output-stream-keeper.h Fri Feb 12 17:31:11 2010 -0800
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 University of Washington
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef OUTPUT_STREAM_KEEPER_H
+#define OUTPUT_STREAM_KEEPER_H
+
+#include <ostream>
+#include "ns3/object.h"
+#include "ns3/ptr.h"
+#include "ns3/simple-ref-count.h"
+
+namespace ns3 {
+
+/*
+ * @brief A class encapsulating an STL output stream.
+ *
+ * One of the common issues users run into when trying to use tracing in ns-3
+ * is actually due to a design decision made in the C++ stream library.
+ *
+ * It is not widely known, but copy and assignment of iostreams is forbidden by
+ * std::basic_ios<>. This is because it is not possible to predict the
+ * semantics of the stream desired by a user.
+ *
+ * When writing traced information to a file, the tempting ns-3 idiom is to
+ * create a bound callback with an ofstream as the bound object. Unfortunately,
+ * this implies a copy construction in order to get the ofstream object into the
+ * callback. This operation, as mentioned above, is forbidden by the STL. One
+ * could use a global ostream and pass a pointer to it, but that is pretty ugly.
+ * One could also create an ostream on the stack and pass a pointer to it in the
+ * callback, but object lifetime issues will quickly rear their ugly heads. It
+ * turns out that ns-3 has a nifty reference counted object that can solve the
+ * value semantics and object lifetime issues, so we provide one of those to
+ * carry the stream around.
+ *
+ * The experienced C++ wizard may ask, "what's the point of such a simple class."
+ * but this isn't oriented toward them. We use this to make a simple thing
+ * simple to do for new users; and also as a simple example of ns-3 objects at a
+ * high level. We know of a couple of high-powered experienced developers that
+ * have been tripped up by this and decided that it must be an ns-3 bug.
+ *
+ * One could imagine having this object inherit from stream to get the various
+ * overloaded operator<< defined, but we're going to be using a
+ * Ptr<OutputStreamKeeper> when passing this object around. In this case, the
+ * Ptr<> wouldn't understand the operators and we would have to dereference it
+ * to access the underlying object methods. Since we would have to dereference
+ * the Ptr<>, we don't bother and just expect the user to Get a saved pointer
+ * to an ostream and dereference it him or herself. As in:
+ *
+ * \verbatim
+ * void
+ * TraceSink (Ptr<OutputStreamKeeper> streamKeeper, Ptr<const Packet> packet)
+ * {
+ * std::ostream *stream = streamKeeper->GetStream ();
+ * *stream << "got packet" << std::endl;
+ * }
+ * \endverbatim
+ */
+class OutputStreamKeeper : public SimpleRefCount<OutputStreamKeeper>
+{
+public:
+ static TypeId GetTypeId (void);
+
+ OutputStreamKeeper ();
+ ~OutputStreamKeeper ();
+
+ void SetStream (std::ostream *ostream);
+ std::ostream *GetStream (void);
+
+private:
+ std::ostream *m_ostream;
+};
+
+} //namespace ns3
+
+#endif // OUTPUT_STREAM_KEEPER_H
--- a/src/common/output-stream-object.cc Fri Feb 12 16:44:15 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2010 University of Washington
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "ns3/log.h"
-#include "output-stream-object.h"
-
-NS_LOG_COMPONENT_DEFINE ("OutputStreamObject");
-
-namespace ns3 {
-
-OutputStreamObject::OutputStreamObject ()
- : m_ostream (0)
-{
-}
-
-OutputStreamObject::~OutputStreamObject ()
-{
- delete m_ostream;
- m_ostream = 0;
-}
-
-void
-OutputStreamObject::SetStream (std::ostream *ostream)
-{
- m_ostream = ostream;
-}
-
-std::ostream *
-OutputStreamObject::GetStream (void)
-{
- return m_ostream;
-}
-
-} //namespace ns3
--- a/src/common/output-stream-object.h Fri Feb 12 16:44:15 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2010 University of Washington
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef OUTPUT_STREAM_OBJECT_H
-#define OUTPUT_STREAM_OBJECT_H
-
-#include <ostream>
-#include "ns3/object.h"
-#include "ns3/ptr.h"
-#include "ns3/simple-ref-count.h"
-
-namespace ns3 {
-
-/*
- * @brief A class encapsulating an STL output stream.
- *
- * One of the common issues users run into when trying to use tracing in ns-3
- * is actually due to a design decision made in the C++ stream library.
- *
- * It is not widely known, but copy and assignment of iostreams is forbidden by
- * std::basic_ios<>. This is because it is not possible to predict the
- * semantics of the stream desired by a user.
- *
- * When writing traced information to a file, the tempting ns-3 idiom is to
- * create a bound callback with an ofstream as the bound object. Unfortunately,
- * this implies a copy construction in order to get the ofstream object into the
- * callback. This operation, as mentioned above, is forbidden by the STL. One
- * could use a global ostream and pass a pointer to it, but that is pretty ugly.
- * One could also create an ostream on the stack and pass a pointer to it in the
- * callback, but object lifetime issues will quickly rear their ugly heads. It
- * turns out that ns-3 has a nifty reference counted object that can solve the
- * value semantics and object lifetime issues, so we provide one of those to
- * carry the stream around.
- *
- * The experienced C++ wizard may ask, "what's the point of such a simple class."
- * but this isn't oriented toward them. We use this to make a simple thing
- * simple to do for new users; and also as a simple example of ns-3 objects at a
- * high level. We know of a couple of high-powered experienced developers that
- * have been tripped up by this and decided that it must be an ns-3 bug.
- *
- * One could imagine having this object inherit from stream to get the various
- * overloaded operator<< defined, but we're going to be using a
- * Ptr<OutputStreamObject> when passing this object around. In this case, the
- * Ptr<> wouldn't understand the operators and we would have to dereference it
- * to access the underlying object methods. Since we would have to dereference
- * the Ptr<>, we don't bother and just expect the user to Get a saved pointer
- * to an ostream and dereference it him or herself. As in:
- *
- * \verbatim
- * void
- * TraceSink (Ptr<OutputStreamObject> streamObject, Ptr<const Packet> packet)
- * {
- * std::ostream *stream = streamObject->GetStream ();
- * *stream << "got packet" << std::endl;
- * }
- * \endverbatim
- */
-class OutputStreamObject : public SimpleRefCount<OutputStreamObject>
-{
-public:
- static TypeId GetTypeId (void);
-
- OutputStreamObject ();
- ~OutputStreamObject ();
-
- void SetStream (std::ostream *ostream);
- std::ostream *GetStream (void);
-
-private:
- std::ostream *m_ostream;
-};
-
-} //namespace ns3
-
-#endif // OUTPUT_STREAM_OBJECT_H
--- a/src/common/wscript Fri Feb 12 16:44:15 2010 -0800
+++ b/src/common/wscript Fri Feb 12 17:31:11 2010 -0800
@@ -20,7 +20,7 @@
'pcap-file.cc',
'pcap-file-test-suite.cc',
'pcap-file-object.cc',
- 'output-stream-object.cc',
+ 'output-stream-keeper.cc',
'propagation-delay-model.cc',
'propagation-loss-model.cc',
'propagation-loss-model-test-suite.cc',
@@ -46,7 +46,7 @@
'sgi-hashmap.h',
'pcap-file.h',
'pcap-file-object.h',
- 'output-stream-object.h',
+ 'output-stream-keeper.h',
'propagation-delay-model.h',
'propagation-loss-model.h',
'jakes-propagation-loss-model.h',
--- a/src/helper/csma-helper.cc Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/csma-helper.cc Fri Feb 12 17:31:11 2010 -0800
@@ -100,7 +100,7 @@
}
void
-CsmaHelper::EnableAsciiInternal (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<NetDevice> nd)
+CsmaHelper::EnableAsciiInternal (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<NetDevice> nd)
{
//
// All of the ascii enable functions vector through here including the ones
@@ -121,7 +121,7 @@
Packet::EnablePrinting ();
//
- // If we are not provided an OutputStreamObject, we are expected to create
+ // If we are not provided an OutputStreamKeeper, we are expected to create
// one using the usual trace filename conventions and do a Hook*WithoutContext
// since there will be one file per context and therefore the context would
// be redundant.
@@ -135,7 +135,7 @@
//
AsciiTraceHelper asciiTraceHelper;
std::string filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device);
- Ptr<OutputStreamObject> theStream = asciiTraceHelper.CreateFileStream (filename, "w");
+ Ptr<OutputStreamKeeper> theStream = asciiTraceHelper.CreateFileStream (filename, "w");
//
// The MacRx trace source provides our "r" event.
@@ -155,7 +155,7 @@
}
//
- // If we are provided an OutputStreamObject, we are expected to use it, and
+ // If we are provided an OutputStreamKeeper, we are expected to use it, and
// to providd a context. We are free to come up with our own context if we
// want, and use the AsciiTraceHelper Hook*WithContext functions, but for
// compatibility and simplicity, we just use Config::Connect and let it deal
--- a/src/helper/csma-helper.h Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/csma-helper.h Fri Feb 12 17:31:11 2010 -0800
@@ -221,7 +221,7 @@
* \param prefix Filename prefix to use for ascii trace files.
* \param nd Net device for which you want to enable tracing.
*/
- virtual void EnableAsciiInternal (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<NetDevice> nd);
+ virtual void EnableAsciiInternal (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<NetDevice> nd);
ObjectFactory m_queueFactory;
ObjectFactory m_deviceFactory;
--- a/src/helper/emu-helper.cc Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/emu-helper.cc Fri Feb 12 17:31:11 2010 -0800
@@ -93,7 +93,7 @@
}
void
-EmuHelper::EnableAsciiInternal (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<NetDevice> nd)
+EmuHelper::EnableAsciiInternal (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<NetDevice> nd)
{
//
// All of the ascii enable functions vector through here including the ones
@@ -114,7 +114,7 @@
Packet::EnablePrinting ();
//
- // If we are not provided an OutputStreamObject, we are expected to create
+ // If we are not provided an OutputStreamKeeper, we are expected to create
// one using the usual trace filename conventions and do a Hook*WithoutContext
// since there will be one file per context and therefore the context would
// be redundant.
@@ -128,7 +128,7 @@
//
AsciiTraceHelper asciiTraceHelper;
std::string filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device);
- Ptr<OutputStreamObject> theStream = asciiTraceHelper.CreateFileStream (filename, "w");
+ Ptr<OutputStreamKeeper> theStream = asciiTraceHelper.CreateFileStream (filename, "w");
//
// The MacRx trace source provides our "r" event.
@@ -148,7 +148,7 @@
}
//
- // If we are provided an OutputStreamObject, we are expected to use it, and
+ // If we are provided an OutputStreamKeeper, we are expected to use it, and
// to providd a context. We are free to come up with our own context if we
// want, and use the AsciiTraceHelper Hook*WithContext functions, but for
// compatibility and simplicity, we just use Config::Connect and let it deal
--- a/src/helper/emu-helper.h Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/emu-helper.h Fri Feb 12 17:31:11 2010 -0800
@@ -138,7 +138,7 @@
* \param prefix Filename prefix to use for ascii trace files.
* \param nd Net device for which you want to enable tracing.
*/
- virtual void EnableAsciiInternal (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<NetDevice> nd);
+ virtual void EnableAsciiInternal (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<NetDevice> nd);
ObjectFactory m_queueFactory;
ObjectFactory m_deviceFactory;
--- a/src/helper/internet-stack-helper.cc Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/internet-stack-helper.cc Fri Feb 12 17:31:11 2010 -0800
@@ -212,14 +212,14 @@
//
typedef std::pair<Ptr<Ipv4>, uint32_t> InterfacePairIpv4;
typedef std::map<InterfacePairIpv4, Ptr<PcapFileObject> > InterfaceFileMapIpv4;
-typedef std::map<InterfacePairIpv4, Ptr<OutputStreamObject> > InterfaceStreamMapIpv4;
+typedef std::map<InterfacePairIpv4, Ptr<OutputStreamKeeper> > InterfaceStreamMapIpv4;
static InterfaceFileMapIpv4 g_interfaceFileMapIpv4; /**< A mapping of Ipv4/interface pairs to pcap files */
static InterfaceStreamMapIpv4 g_interfaceStreamMapIpv4; /**< A mapping of Ipv4/interface pairs to ascii streams */
typedef std::pair<Ptr<Ipv6>, uint32_t> InterfacePairIpv6;
typedef std::map<InterfacePairIpv6, Ptr<PcapFileObject> > InterfaceFileMapIpv6;
-typedef std::map<InterfacePairIpv6, Ptr<OutputStreamObject> > InterfaceStreamMapIpv6;
+typedef std::map<InterfacePairIpv6, Ptr<OutputStreamKeeper> > InterfaceStreamMapIpv6;
static InterfaceFileMapIpv6 g_interfaceFileMapIpv6; /**< A mapping of Ipv6/interface pairs to pcap files */
static InterfaceStreamMapIpv6 g_interfaceStreamMapIpv6; /**< A mapping of Ipv6/interface pairs to pcap files */
@@ -572,7 +572,7 @@
static void
Ipv4L3ProtocolDropSinkWithoutContext (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
Ipv4Header const &header,
Ptr<const Packet> packet,
Ipv4L3Protocol::DropReason reason,
@@ -599,7 +599,7 @@
static void
Ipv4L3ProtocolDropSinkWithContext (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
std::string context,
Ipv4Header const &header,
Ptr<const Packet> packet,
@@ -647,7 +647,7 @@
void
InternetStackHelper::EnableAsciiIpv4Internal (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
std::string prefix,
Ptr<Ipv4> ipv4,
uint32_t interface)
@@ -665,7 +665,7 @@
Packet::EnablePrinting ();
//
- // If we are not provided an OutputStreamObject, we are expected to create
+ // If we are not provided an OutputStreamKeeper, we are expected to create
// one using the usual trace filename conventions and hook WithoutContext
// since there will be one file per context and therefore the context would
// be redundant.
@@ -683,7 +683,7 @@
//
AsciiTraceHelper asciiTraceHelper;
std::string filename = asciiTraceHelper.GetFilenameFromInterfacePair (prefix, ipv4, interface);
- Ptr<OutputStreamObject> theStream = asciiTraceHelper.CreateFileStream (filename, "w");
+ Ptr<OutputStreamKeeper> theStream = asciiTraceHelper.CreateFileStream (filename, "w");
//
// However, we only hook the trace sources once to avoid multiple trace sink
@@ -717,7 +717,7 @@
}
//
- // If we are provided an OutputStreamObject, we are expected to use it, and
+ // If we are provided an OutputStreamKeeper, we are expected to use it, and
// to provide a context. We are free to come up with our own context if we
// want, and use the AsciiTraceHelper Hook*WithContext functions, but for
// compatibility and simplicity, we just use Config::Connect and let it deal
@@ -756,7 +756,7 @@
static void
Ipv6L3ProtocolDropSinkWithoutContext (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
Ipv6Header const &header,
Ptr<const Packet> packet,
Ipv6L3Protocol::DropReason reason,
@@ -783,7 +783,7 @@
static void
Ipv6L3ProtocolDropSinkWithContext (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
std::string context,
Ipv6Header const &header,
Ptr<const Packet> packet,
@@ -831,7 +831,7 @@
void
InternetStackHelper::EnableAsciiIpv6Internal (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
std::string prefix,
Ptr<Ipv6> ipv6,
uint32_t interface)
@@ -849,7 +849,7 @@
Packet::EnablePrinting ();
//
- // If we are not provided an OutputStreamObject, we are expected to create
+ // If we are not provided an OutputStreamKeeper, we are expected to create
// one using the usual trace filename conventions and do a hook WithoutContext
// since there will be one file per context and therefore the context would
// be redundant.
@@ -867,7 +867,7 @@
//
AsciiTraceHelper asciiTraceHelper;
std::string filename = asciiTraceHelper.GetFilenameFromInterfacePair (prefix, ipv6, interface);
- Ptr<OutputStreamObject> theStream = asciiTraceHelper.CreateFileStream (filename, "w");
+ Ptr<OutputStreamKeeper> theStream = asciiTraceHelper.CreateFileStream (filename, "w");
//
// However, we only hook the trace sources once to avoid multiple trace sink
@@ -893,7 +893,7 @@
}
//
- // If we are provided an OutputStreamObject, we are expected to use it, and
+ // If we are provided an OutputStreamKeeper, we are expected to use it, and
// to provide a context. We are free to come up with our own context if we
// want, and use the AsciiTraceHelper Hook*WithContext functions, but for
// compatibility and simplicity, we just use Config::Connect and let it deal
--- a/src/helper/internet-stack-helper.h Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/internet-stack-helper.h Fri Feb 12 17:31:11 2010 -0800
@@ -185,13 +185,13 @@
* @brief Enable ascii trace output on the indicated Ipv4 and interface pair.
* @internal
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param prefix Filename prefix to use for ascii trace files.
* @param ipv4 Ptr to the Ipv4 interface on which you want to enable tracing.
* @param interface Interface ID on the Ipv4 on which you want to enable tracing.
*/
- virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamObject> stream, std::string prefix,
+ virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamKeeper> stream, std::string prefix,
Ptr<Ipv4> ipv4, uint32_t interface);
/**
@@ -209,13 +209,13 @@
* @brief Enable ascii trace output on the indicated Ipv4 and interface pair.
* @internal
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param prefix Filename prefix to use for ascii trace files.
* @param ipv4 Ptr to the Ipv4 interface on which you want to enable tracing.
* @param interface Interface ID on the Ipv4 on which you want to enable tracing.
*/
- virtual void EnableAsciiIpv6Internal (Ptr<OutputStreamObject> stream, std::string prefix,
+ virtual void EnableAsciiIpv6Internal (Ptr<OutputStreamKeeper> stream, std::string prefix,
Ptr<Ipv6> ipv6, uint32_t interface);
void Initialize (void);
--- a/src/helper/point-to-point-helper.cc Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/point-to-point-helper.cc Fri Feb 12 17:31:11 2010 -0800
@@ -90,7 +90,7 @@
}
void
-PointToPointHelper::EnableAsciiInternal (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<NetDevice> nd)
+PointToPointHelper::EnableAsciiInternal (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<NetDevice> nd)
{
//
// All of the ascii enable functions vector through here including the ones
@@ -112,7 +112,7 @@
Packet::EnablePrinting ();
//
- // If we are not provided an OutputStreamObject, we are expected to create
+ // If we are not provided an OutputStreamKeeper, we are expected to create
// one using the usual trace filename conventions and do a Hook*WithoutContext
// since there will be one file per context and therefore the context would
// be redundant.
@@ -126,7 +126,7 @@
//
AsciiTraceHelper asciiTraceHelper;
std::string filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device);
- Ptr<OutputStreamObject> theStream = asciiTraceHelper.CreateFileStream (filename, "w");
+ Ptr<OutputStreamKeeper> theStream = asciiTraceHelper.CreateFileStream (filename, "w");
//
// The MacRx trace source provides our "r" event.
@@ -146,7 +146,7 @@
}
//
- // If we are provided an OutputStreamObject, we are expected to use it, and
+ // If we are provided an OutputStreamKeeper, we are expected to use it, and
// to providd a context. We are free to come up with our own context if we
// want, and use the AsciiTraceHelper Hook*WithContext functions, but for
// compatibility and simplicity, we just use Config::Connect and let it deal
--- a/src/helper/point-to-point-helper.h Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/point-to-point-helper.h Fri Feb 12 17:31:11 2010 -0800
@@ -167,7 +167,7 @@
* \param prefix Filename prefix to use for ascii trace files.
* \param nd Net device for which you want to enable tracing.
*/
- virtual void EnableAsciiInternal (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<NetDevice> nd);
+ virtual void EnableAsciiInternal (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<NetDevice> nd);
ObjectFactory m_queueFactory;
ObjectFactory m_channelFactory;
--- a/src/helper/trace-helper.cc Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/trace-helper.cc Fri Feb 12 17:31:11 2010 -0800
@@ -180,7 +180,7 @@
NS_LOG_FUNCTION_NOARGS ();
}
-Ptr<OutputStreamObject>
+Ptr<OutputStreamKeeper>
AsciiTraceHelper::CreateFileStream (std::string filename, std::string filemode)
{
NS_LOG_FUNCTION (filename << filemode);
@@ -205,8 +205,8 @@
NS_ABORT_MSG_UNLESS (ofstream->is_open (), "AsciiTraceHelper::CreateFileStream(): Unable to Open " <<
filename << " for mode " << filemode);
- Ptr<OutputStreamObject> streamObject = Create<OutputStreamObject> ();
- streamObject->SetStream (ofstream);
+ Ptr<OutputStreamKeeper> StreamKeeper = Create<OutputStreamKeeper> ();
+ StreamKeeper->SetStream (ofstream);
//
// Note that the ascii trace helper promptly forgets all about the trace file.
@@ -219,7 +219,7 @@
// and the stream object will be destroyed, releasing the pointer and closing
// the underlying file.
//
- return streamObject;
+ return StreamKeeper;
}
std::string
@@ -321,14 +321,14 @@
// in the device (actually the Queue in the device).
//
void
-AsciiTraceHelper::DefaultEnqueueSinkWithoutContext (Ptr<OutputStreamObject> stream, Ptr<const Packet> p)
+AsciiTraceHelper::DefaultEnqueueSinkWithoutContext (Ptr<OutputStreamKeeper> stream, Ptr<const Packet> p)
{
NS_LOG_FUNCTION (stream << p);
*stream->GetStream () << "+ " << Simulator::Now ().GetSeconds () << " " << *p << std::endl;
}
void
-AsciiTraceHelper::DefaultEnqueueSinkWithContext (Ptr<OutputStreamObject> stream, std::string context, Ptr<const Packet> p)
+AsciiTraceHelper::DefaultEnqueueSinkWithContext (Ptr<OutputStreamKeeper> stream, std::string context, Ptr<const Packet> p)
{
NS_LOG_FUNCTION (stream << p);
*stream->GetStream () << "+ " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
@@ -347,14 +347,14 @@
// in the device (actually the Queue in the device).
//
void
-AsciiTraceHelper::DefaultDropSinkWithoutContext (Ptr<OutputStreamObject> stream, Ptr<const Packet> p)
+AsciiTraceHelper::DefaultDropSinkWithoutContext (Ptr<OutputStreamKeeper> stream, Ptr<const Packet> p)
{
NS_LOG_FUNCTION (stream << p);
*stream->GetStream () << "d " << Simulator::Now ().GetSeconds () << " " << *p << std::endl;
}
void
-AsciiTraceHelper::DefaultDropSinkWithContext (Ptr<OutputStreamObject> stream, std::string context, Ptr<const Packet> p)
+AsciiTraceHelper::DefaultDropSinkWithContext (Ptr<OutputStreamKeeper> stream, std::string context, Ptr<const Packet> p)
{
NS_LOG_FUNCTION (stream << p);
*stream->GetStream () << "d " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
@@ -374,14 +374,14 @@
// in the device (actually the Queue in the device).
//
void
-AsciiTraceHelper::DefaultDequeueSinkWithoutContext (Ptr<OutputStreamObject> stream, Ptr<const Packet> p)
+AsciiTraceHelper::DefaultDequeueSinkWithoutContext (Ptr<OutputStreamKeeper> stream, Ptr<const Packet> p)
{
NS_LOG_FUNCTION (stream << p);
*stream->GetStream () << "- " << Simulator::Now ().GetSeconds () << " " << *p << std::endl;
}
void
-AsciiTraceHelper::DefaultDequeueSinkWithContext (Ptr<OutputStreamObject> stream, std::string context, Ptr<const Packet> p)
+AsciiTraceHelper::DefaultDequeueSinkWithContext (Ptr<OutputStreamKeeper> stream, std::string context, Ptr<const Packet> p)
{
NS_LOG_FUNCTION (stream << p);
*stream->GetStream () << "- " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
@@ -398,14 +398,14 @@
// This is typically implemented by hooking the "MacRx" trace hook in the
// device.
void
-AsciiTraceHelper::DefaultReceiveSinkWithoutContext (Ptr<OutputStreamObject> stream, Ptr<const Packet> p)
+AsciiTraceHelper::DefaultReceiveSinkWithoutContext (Ptr<OutputStreamKeeper> stream, Ptr<const Packet> p)
{
NS_LOG_FUNCTION (stream << p);
*stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << *p << std::endl;
}
void
-AsciiTraceHelper::DefaultReceiveSinkWithContext (Ptr<OutputStreamObject> stream, std::string context, Ptr<const Packet> p)
+AsciiTraceHelper::DefaultReceiveSinkWithContext (Ptr<OutputStreamKeeper> stream, std::string context, Ptr<const Packet> p)
{
NS_LOG_FUNCTION (stream << p);
*stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
@@ -482,14 +482,14 @@
void
AsciiTraceHelperForDevice::EnableAscii (std::string prefix, Ptr<NetDevice> nd)
{
- EnableAsciiInternal (Ptr<OutputStreamObject> (), prefix, nd);
+ EnableAsciiInternal (Ptr<OutputStreamKeeper> (), prefix, nd);
}
//
// Public API
//
void
-AsciiTraceHelperForDevice::EnableAscii (Ptr<OutputStreamObject> stream, Ptr<NetDevice> nd)
+AsciiTraceHelperForDevice::EnableAscii (Ptr<OutputStreamKeeper> stream, Ptr<NetDevice> nd)
{
EnableAsciiInternal (stream, std::string (), nd);
}
@@ -500,14 +500,14 @@
void
AsciiTraceHelperForDevice::EnableAscii (std::string prefix, std::string ndName)
{
- EnableAsciiImpl (Ptr<OutputStreamObject> (), prefix, ndName);
+ EnableAsciiImpl (Ptr<OutputStreamKeeper> (), prefix, ndName);
}
//
// Public API
//
void
-AsciiTraceHelperForDevice::EnableAscii (Ptr<OutputStreamObject> stream, std::string ndName)
+AsciiTraceHelperForDevice::EnableAscii (Ptr<OutputStreamKeeper> stream, std::string ndName)
{
EnableAsciiImpl (stream, std::string (), ndName);
}
@@ -516,7 +516,7 @@
// Private API
//
void
-AsciiTraceHelperForDevice::EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, std::string ndName)
+AsciiTraceHelperForDevice::EnableAsciiImpl (Ptr<OutputStreamKeeper> stream, std::string prefix, std::string ndName)
{
Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
EnableAsciiInternal (stream, prefix, nd);
@@ -528,14 +528,14 @@
void
AsciiTraceHelperForDevice::EnableAscii (std::string prefix, NetDeviceContainer d)
{
- EnableAsciiImpl (Ptr<OutputStreamObject> (), prefix, d);
+ EnableAsciiImpl (Ptr<OutputStreamKeeper> (), prefix, d);
}
//
// Public API
//
void
-AsciiTraceHelperForDevice::EnableAscii (Ptr<OutputStreamObject> stream, NetDeviceContainer d)
+AsciiTraceHelperForDevice::EnableAscii (Ptr<OutputStreamKeeper> stream, NetDeviceContainer d)
{
EnableAsciiImpl (stream, std::string (), d);
}
@@ -544,7 +544,7 @@
// Private API
//
void
-AsciiTraceHelperForDevice::EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, NetDeviceContainer d)
+AsciiTraceHelperForDevice::EnableAsciiImpl (Ptr<OutputStreamKeeper> stream, std::string prefix, NetDeviceContainer d)
{
for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
{
@@ -559,14 +559,14 @@
void
AsciiTraceHelperForDevice::EnableAscii (std::string prefix, NodeContainer n)
{
- EnableAsciiImpl (Ptr<OutputStreamObject> (), prefix, n);
+ EnableAsciiImpl (Ptr<OutputStreamKeeper> (), prefix, n);
}
//
// Public API
//
void
-AsciiTraceHelperForDevice::EnableAscii (Ptr<OutputStreamObject> stream, NodeContainer n)
+AsciiTraceHelperForDevice::EnableAscii (Ptr<OutputStreamKeeper> stream, NodeContainer n)
{
EnableAsciiImpl (stream, std::string (), n);
}
@@ -575,7 +575,7 @@
// Private API
//
void
-AsciiTraceHelperForDevice::EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, NodeContainer n)
+AsciiTraceHelperForDevice::EnableAsciiImpl (Ptr<OutputStreamKeeper> stream, std::string prefix, NodeContainer n)
{
NetDeviceContainer devs;
for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
@@ -595,14 +595,14 @@
void
AsciiTraceHelperForDevice::EnableAsciiAll (std::string prefix)
{
- EnableAsciiImpl (Ptr<OutputStreamObject> (), prefix, NodeContainer::GetGlobal ());
+ EnableAsciiImpl (Ptr<OutputStreamKeeper> (), prefix, NodeContainer::GetGlobal ());
}
//
// Public API
//
void
-AsciiTraceHelperForDevice::EnableAsciiAll (Ptr<OutputStreamObject> stream)
+AsciiTraceHelperForDevice::EnableAsciiAll (Ptr<OutputStreamKeeper> stream)
{
EnableAsciiImpl (stream, std::string (), NodeContainer::GetGlobal ());
}
@@ -611,7 +611,7 @@
// Public API
//
void
-AsciiTraceHelperForDevice::EnableAscii (Ptr<OutputStreamObject> stream, uint32_t nodeid, uint32_t deviceid)
+AsciiTraceHelperForDevice::EnableAscii (Ptr<OutputStreamKeeper> stream, uint32_t nodeid, uint32_t deviceid)
{
EnableAsciiImpl (stream, std::string (), nodeid, deviceid);
}
@@ -622,7 +622,7 @@
void
AsciiTraceHelperForDevice::EnableAscii (std::string prefix, uint32_t nodeid, uint32_t deviceid)
{
- EnableAsciiImpl (Ptr<OutputStreamObject> (), prefix, nodeid, deviceid);
+ EnableAsciiImpl (Ptr<OutputStreamKeeper> (), prefix, nodeid, deviceid);
}
//
@@ -630,7 +630,7 @@
//
void
AsciiTraceHelperForDevice::EnableAsciiImpl (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
std::string prefix,
uint32_t nodeid,
uint32_t deviceid)
@@ -729,14 +729,14 @@
void
AsciiTraceHelperForIpv4::EnableAsciiIpv4 (std::string prefix, Ptr<Ipv4> ipv4, uint32_t interface)
{
- EnableAsciiIpv4Internal (Ptr<OutputStreamObject> (), prefix, ipv4, interface);
+ EnableAsciiIpv4Internal (Ptr<OutputStreamKeeper> (), prefix, ipv4, interface);
}
//
// Public API
//
void
-AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, Ptr<Ipv4> ipv4, uint32_t interface)
+AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, Ptr<Ipv4> ipv4, uint32_t interface)
{
EnableAsciiIpv4Internal (stream, std::string (), ipv4, interface);
}
@@ -747,14 +747,14 @@
void
AsciiTraceHelperForIpv4::EnableAsciiIpv4 (std::string prefix, std::string ipv4Name, uint32_t interface)
{
- EnableAsciiIpv4Impl (Ptr<OutputStreamObject> (), prefix, ipv4Name, interface);
+ EnableAsciiIpv4Impl (Ptr<OutputStreamKeeper> (), prefix, ipv4Name, interface);
}
//
// Public API
//
void
-AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, std::string ipv4Name, uint32_t interface)
+AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, std::string ipv4Name, uint32_t interface)
{
EnableAsciiIpv4Impl (stream, std::string (), ipv4Name, interface);
}
@@ -764,7 +764,7 @@
//
void
AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
std::string prefix,
std::string ipv4Name,
uint32_t interface)
@@ -779,14 +779,14 @@
void
AsciiTraceHelperForIpv4::EnableAsciiIpv4 (std::string prefix, Ipv4InterfaceContainer c)
{
- EnableAsciiIpv4Impl (Ptr<OutputStreamObject> (), prefix, c);
+ EnableAsciiIpv4Impl (Ptr<OutputStreamKeeper> (), prefix, c);
}
//
// Public API
//
void
-AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, Ipv4InterfaceContainer c)
+AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, Ipv4InterfaceContainer c)
{
EnableAsciiIpv4Impl (stream, std::string (), c);
}
@@ -795,7 +795,7 @@
// Private API
//
void
-AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl (Ptr<OutputStreamObject> stream, std::string prefix, Ipv4InterfaceContainer c)
+AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, Ipv4InterfaceContainer c)
{
for (Ipv4InterfaceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
{
@@ -810,14 +810,14 @@
void
AsciiTraceHelperForIpv4::EnableAsciiIpv4 (std::string prefix, NodeContainer n)
{
- EnableAsciiIpv4Impl (Ptr<OutputStreamObject> (), prefix, n);
+ EnableAsciiIpv4Impl (Ptr<OutputStreamKeeper> (), prefix, n);
}
//
// Public API
//
void
-AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, NodeContainer n)
+AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, NodeContainer n)
{
EnableAsciiIpv4Impl (stream, std::string (), n);
}
@@ -826,7 +826,7 @@
// Private API
//
void
-AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl (Ptr<OutputStreamObject> stream, std::string prefix, NodeContainer n)
+AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, NodeContainer n)
{
for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
{
@@ -848,14 +848,14 @@
void
AsciiTraceHelperForIpv4::EnableAsciiIpv4All (std::string prefix)
{
- EnableAsciiIpv4Impl (Ptr<OutputStreamObject> (), prefix, NodeContainer::GetGlobal ());
+ EnableAsciiIpv4Impl (Ptr<OutputStreamKeeper> (), prefix, NodeContainer::GetGlobal ());
}
//
// Public API
//
void
-AsciiTraceHelperForIpv4::EnableAsciiIpv4All (Ptr<OutputStreamObject> stream)
+AsciiTraceHelperForIpv4::EnableAsciiIpv4All (Ptr<OutputStreamKeeper> stream)
{
EnableAsciiIpv4Impl (stream, std::string (), NodeContainer::GetGlobal ());
}
@@ -864,7 +864,7 @@
// Public API
//
void
-AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, uint32_t nodeid, uint32_t interface)
+AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, uint32_t nodeid, uint32_t interface)
{
EnableAsciiIpv4Impl (stream, std::string (), nodeid, interface);
}
@@ -875,7 +875,7 @@
void
AsciiTraceHelperForIpv4::EnableAsciiIpv4 (std::string prefix, uint32_t nodeid, uint32_t interface)
{
- EnableAsciiIpv4Impl (Ptr<OutputStreamObject> (), prefix, nodeid, interface);
+ EnableAsciiIpv4Impl (Ptr<OutputStreamKeeper> (), prefix, nodeid, interface);
}
//
@@ -883,7 +883,7 @@
//
void
AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
std::string prefix,
uint32_t nodeid,
uint32_t interface)
@@ -982,14 +982,14 @@
void
AsciiTraceHelperForIpv6::EnableAsciiIpv6 (std::string prefix, Ptr<Ipv6> ipv6, uint32_t interface)
{
- EnableAsciiIpv6Internal (Ptr<OutputStreamObject> (), prefix, ipv6, interface);
+ EnableAsciiIpv6Internal (Ptr<OutputStreamKeeper> (), prefix, ipv6, interface);
}
//
// Public API
//
void
-AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr<OutputStreamObject> stream, Ptr<Ipv6> ipv6, uint32_t interface)
+AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr<OutputStreamKeeper> stream, Ptr<Ipv6> ipv6, uint32_t interface)
{
EnableAsciiIpv6Internal (stream, std::string (), ipv6, interface);
}
@@ -1000,14 +1000,14 @@
void
AsciiTraceHelperForIpv6::EnableAsciiIpv6 (std::string prefix, std::string ipv6Name, uint32_t interface)
{
- EnableAsciiIpv6Impl (Ptr<OutputStreamObject> (), prefix, ipv6Name, interface);
+ EnableAsciiIpv6Impl (Ptr<OutputStreamKeeper> (), prefix, ipv6Name, interface);
}
//
// Public API
//
void
-AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr<OutputStreamObject> stream, std::string ipv6Name, uint32_t interface)
+AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr<OutputStreamKeeper> stream, std::string ipv6Name, uint32_t interface)
{
EnableAsciiIpv6Impl (stream, std::string (), ipv6Name, interface);
}
@@ -1017,7 +1017,7 @@
//
void
AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
std::string prefix,
std::string ipv6Name,
uint32_t interface)
@@ -1032,14 +1032,14 @@
void
AsciiTraceHelperForIpv6::EnableAsciiIpv6 (std::string prefix, Ipv6InterfaceContainer c)
{
- EnableAsciiIpv6Impl (Ptr<OutputStreamObject> (), prefix, c);
+ EnableAsciiIpv6Impl (Ptr<OutputStreamKeeper> (), prefix, c);
}
//
// Public API
//
void
-AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr<OutputStreamObject> stream, Ipv6InterfaceContainer c)
+AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr<OutputStreamKeeper> stream, Ipv6InterfaceContainer c)
{
EnableAsciiIpv6Impl (stream, std::string (), c);
}
@@ -1048,7 +1048,7 @@
// Private API
//
void
-AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl (Ptr<OutputStreamObject> stream, std::string prefix, Ipv6InterfaceContainer c)
+AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, Ipv6InterfaceContainer c)
{
for (Ipv6InterfaceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
{
@@ -1063,14 +1063,14 @@
void
AsciiTraceHelperForIpv6::EnableAsciiIpv6 (std::string prefix, NodeContainer n)
{
- EnableAsciiIpv6Impl (Ptr<OutputStreamObject> (), prefix, n);
+ EnableAsciiIpv6Impl (Ptr<OutputStreamKeeper> (), prefix, n);
}
//
// Public API
//
void
-AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr<OutputStreamObject> stream, NodeContainer n)
+AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr<OutputStreamKeeper> stream, NodeContainer n)
{
EnableAsciiIpv6Impl (stream, std::string (), n);
}
@@ -1079,7 +1079,7 @@
// Private API
//
void
-AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl (Ptr<OutputStreamObject> stream, std::string prefix, NodeContainer n)
+AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, NodeContainer n)
{
for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
{
@@ -1101,14 +1101,14 @@
void
AsciiTraceHelperForIpv6::EnableAsciiIpv6All (std::string prefix)
{
- EnableAsciiIpv6Impl (Ptr<OutputStreamObject> (), prefix, NodeContainer::GetGlobal ());
+ EnableAsciiIpv6Impl (Ptr<OutputStreamKeeper> (), prefix, NodeContainer::GetGlobal ());
}
//
// Public API
//
void
-AsciiTraceHelperForIpv6::EnableAsciiIpv6All (Ptr<OutputStreamObject> stream)
+AsciiTraceHelperForIpv6::EnableAsciiIpv6All (Ptr<OutputStreamKeeper> stream)
{
EnableAsciiIpv6Impl (stream, std::string (), NodeContainer::GetGlobal ());
}
@@ -1117,7 +1117,7 @@
// Public API
//
void
-AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr<OutputStreamObject> stream, uint32_t nodeid, uint32_t interface)
+AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr<OutputStreamKeeper> stream, uint32_t nodeid, uint32_t interface)
{
EnableAsciiIpv6Impl (stream, std::string (), nodeid, interface);
}
@@ -1128,7 +1128,7 @@
void
AsciiTraceHelperForIpv6::EnableAsciiIpv6 (std::string prefix, uint32_t nodeid, uint32_t interface)
{
- EnableAsciiIpv6Impl (Ptr<OutputStreamObject> (), prefix, nodeid, interface);
+ EnableAsciiIpv6Impl (Ptr<OutputStreamKeeper> (), prefix, nodeid, interface);
}
//
@@ -1136,7 +1136,7 @@
//
void
AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
std::string prefix,
uint32_t nodeid,
uint32_t interface)
--- a/src/helper/trace-helper.h Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/trace-helper.h Fri Feb 12 17:31:11 2010 -0800
@@ -26,7 +26,7 @@
#include "ns3/node-container.h"
#include "ns3/simulator.h"
#include "ns3/pcap-file-object.h"
-#include "ns3/output-stream-object.h"
+#include "ns3/output-stream-keeper.h"
#include "ns3/ipv4.h"
#include "ns3/ipv6.h"
@@ -156,14 +156,14 @@
* that can solve the problem so we use one of those to carry the stream
* around and deal with the lifetime issues.
*/
- Ptr<OutputStreamObject> CreateFileStream (std::string filename, std::string filemode = "w");
+ Ptr<OutputStreamKeeper> CreateFileStream (std::string filename, std::string filemode = "w");
/**
* @brief Hook a trace source to the default enqueue operation trace sink that
* does not accept nor log a trace context.
*/
template <typename T>
- void HookDefaultEnqueueSinkWithoutContext (Ptr<T> object, std::string traceName, Ptr<OutputStreamObject> stream);
+ void HookDefaultEnqueueSinkWithoutContext (Ptr<T> object, std::string traceName, Ptr<OutputStreamKeeper> stream);
/**
* @brief Hook a trace source to the default enqueue operation trace sink that
@@ -171,14 +171,14 @@
*/
template <typename T>
void HookDefaultEnqueueSinkWithContext (Ptr<T> object,
- std::string context, std::string traceName, Ptr<OutputStreamObject> stream);
+ std::string context, std::string traceName, Ptr<OutputStreamKeeper> stream);
/**
* @brief Hook a trace source to the default drop operation trace sink that
* does not accept nor log a trace context.
*/
template <typename T>
- void HookDefaultDropSinkWithoutContext (Ptr<T> object, std::string traceName, Ptr<OutputStreamObject> stream);
+ void HookDefaultDropSinkWithoutContext (Ptr<T> object, std::string traceName, Ptr<OutputStreamKeeper> stream);
/**
* @brief Hook a trace source to the default drop operation trace sink that
@@ -186,14 +186,14 @@
*/
template <typename T>
void HookDefaultDropSinkWithContext (Ptr<T> object,
- std::string context, std::string traceName, Ptr<OutputStreamObject> stream);
+ std::string context, std::string traceName, Ptr<OutputStreamKeeper> stream);
/**
* @brief Hook a trace source to the default dequeue operation trace sink
* that does not accept nor log a trace context.
*/
template <typename T>
- void HookDefaultDequeueSinkWithoutContext (Ptr<T> object, std::string traceName, Ptr<OutputStreamObject> stream);
+ void HookDefaultDequeueSinkWithoutContext (Ptr<T> object, std::string traceName, Ptr<OutputStreamKeeper> stream);
/**
* @brief Hook a trace source to the default dequeue operation trace sink
@@ -201,14 +201,14 @@
*/
template <typename T>
void HookDefaultDequeueSinkWithContext (Ptr<T> object,
- std::string context, std::string traceName, Ptr<OutputStreamObject> stream);
+ std::string context, std::string traceName, Ptr<OutputStreamKeeper> stream);
/**
* @brief Hook a trace source to the default receive operation trace sink
* that does not accept nor log a trace context.
*/
template <typename T>
- void HookDefaultReceiveSinkWithoutContext (Ptr<T> object, std::string traceName, Ptr<OutputStreamObject> stream);
+ void HookDefaultReceiveSinkWithoutContext (Ptr<T> object, std::string traceName, Ptr<OutputStreamKeeper> stream);
/**
* @brief Hook a trace source to the default receive operation trace sink
@@ -216,23 +216,23 @@
*/
template <typename T>
void HookDefaultReceiveSinkWithContext (Ptr<T> object,
- std::string context, std::string traceName, Ptr<OutputStreamObject> stream);
+ std::string context, std::string traceName, Ptr<OutputStreamKeeper> stream);
- static void DefaultEnqueueSinkWithoutContext (Ptr<OutputStreamObject> file, Ptr<const Packet> p);
- static void DefaultEnqueueSinkWithContext (Ptr<OutputStreamObject> file, std::string context, Ptr<const Packet> p);
+ static void DefaultEnqueueSinkWithoutContext (Ptr<OutputStreamKeeper> file, Ptr<const Packet> p);
+ static void DefaultEnqueueSinkWithContext (Ptr<OutputStreamKeeper> file, std::string context, Ptr<const Packet> p);
- static void DefaultDropSinkWithoutContext (Ptr<OutputStreamObject> file, Ptr<const Packet> p);
- static void DefaultDropSinkWithContext (Ptr<OutputStreamObject> file, std::string context, Ptr<const Packet> p);
+ static void DefaultDropSinkWithoutContext (Ptr<OutputStreamKeeper> file, Ptr<const Packet> p);
+ static void DefaultDropSinkWithContext (Ptr<OutputStreamKeeper> file, std::string context, Ptr<const Packet> p);
- static void DefaultDequeueSinkWithoutContext (Ptr<OutputStreamObject> file, Ptr<const Packet> p);
- static void DefaultDequeueSinkWithContext (Ptr<OutputStreamObject> file, std::string context, Ptr<const Packet> p);
+ static void DefaultDequeueSinkWithoutContext (Ptr<OutputStreamKeeper> file, Ptr<const Packet> p);
+ static void DefaultDequeueSinkWithContext (Ptr<OutputStreamKeeper> file, std::string context, Ptr<const Packet> p);
- static void DefaultReceiveSinkWithoutContext (Ptr<OutputStreamObject> file, Ptr<const Packet> p);
- static void DefaultReceiveSinkWithContext (Ptr<OutputStreamObject> file, std::string context, Ptr<const Packet> p);
+ static void DefaultReceiveSinkWithoutContext (Ptr<OutputStreamKeeper> file, Ptr<const Packet> p);
+ static void DefaultReceiveSinkWithContext (Ptr<OutputStreamKeeper> file, std::string context, Ptr<const Packet> p);
};
template <typename T> void
-AsciiTraceHelper::HookDefaultEnqueueSinkWithoutContext (Ptr<T> object, std::string tracename, Ptr<OutputStreamObject> file)
+AsciiTraceHelper::HookDefaultEnqueueSinkWithoutContext (Ptr<T> object, std::string tracename, Ptr<OutputStreamKeeper> file)
{
bool __attribute__ ((unused)) result =
object->TraceConnectWithoutContext (tracename, MakeBoundCallback (&DefaultEnqueueSinkWithoutContext, file));
@@ -245,7 +245,7 @@
Ptr<T> object,
std::string context,
std::string tracename,
- Ptr<OutputStreamObject> stream)
+ Ptr<OutputStreamKeeper> stream)
{
bool __attribute__ ((unused)) result =
object->TraceConnect (tracename, context, MakeBoundCallback (&DefaultEnqueueSinkWithContext, stream));
@@ -254,7 +254,7 @@
}
template <typename T> void
-AsciiTraceHelper::HookDefaultDropSinkWithoutContext (Ptr<T> object, std::string tracename, Ptr<OutputStreamObject> file)
+AsciiTraceHelper::HookDefaultDropSinkWithoutContext (Ptr<T> object, std::string tracename, Ptr<OutputStreamKeeper> file)
{
bool __attribute__ ((unused)) result =
object->TraceConnectWithoutContext (tracename, MakeBoundCallback (&DefaultDropSinkWithoutContext, file));
@@ -267,7 +267,7 @@
Ptr<T> object,
std::string context,
std::string tracename,
- Ptr<OutputStreamObject> stream)
+ Ptr<OutputStreamKeeper> stream)
{
bool __attribute__ ((unused)) result =
object->TraceConnect (tracename, context, MakeBoundCallback (&DefaultDropSinkWithContext, stream));
@@ -276,7 +276,7 @@
}
template <typename T> void
-AsciiTraceHelper::HookDefaultDequeueSinkWithoutContext (Ptr<T> object, std::string tracename, Ptr<OutputStreamObject> file)
+AsciiTraceHelper::HookDefaultDequeueSinkWithoutContext (Ptr<T> object, std::string tracename, Ptr<OutputStreamKeeper> file)
{
bool __attribute__ ((unused)) result =
object->TraceConnectWithoutContext (tracename, MakeBoundCallback (&DefaultDequeueSinkWithoutContext, file));
@@ -289,7 +289,7 @@
Ptr<T> object,
std::string context,
std::string tracename,
- Ptr<OutputStreamObject> stream)
+ Ptr<OutputStreamKeeper> stream)
{
bool __attribute__ ((unused)) result =
object->TraceConnect (tracename, context, MakeBoundCallback (&DefaultDequeueSinkWithContext, stream));
@@ -298,7 +298,7 @@
}
template <typename T> void
-AsciiTraceHelper::HookDefaultReceiveSinkWithoutContext (Ptr<T> object, std::string tracename, Ptr<OutputStreamObject> file)
+AsciiTraceHelper::HookDefaultReceiveSinkWithoutContext (Ptr<T> object, std::string tracename, Ptr<OutputStreamKeeper> file)
{
bool __attribute__ ((unused)) result =
object->TraceConnectWithoutContext (tracename, MakeBoundCallback (&DefaultReceiveSinkWithoutContext, file));
@@ -311,7 +311,7 @@
Ptr<T> object,
std::string context,
std::string tracename,
- Ptr<OutputStreamObject> stream)
+ Ptr<OutputStreamKeeper> stream)
{
bool __attribute__ ((unused)) result =
object->TraceConnect (tracename, context, MakeBoundCallback (&DefaultReceiveSinkWithContext, stream));
@@ -405,8 +405,8 @@
* @brief Enable ascii trace output on the indicated net device.
* @internal
*
- * The implementation is expected to use a provided Ptr<OutputStreamObject>
- * if it is non-null. If the OutputStreamObject is null, the implementation
+ * The implementation is expected to use a provided Ptr<OutputStreamKeeper>
+ * if it is non-null. If the OutputStreamKeeper is null, the implementation
* is expected to use a provided prefix to construct a new file name for
* each net device using the rules described in the class overview.
*
@@ -419,12 +419,12 @@
* trace context could be important, so the device implementation is
* expected to TraceConnect.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param prefix Filename prefix to use for ascii trace files.
* @param nd Net device for which you want to enable tracing.
*/
- virtual void EnableAsciiInternal (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<NetDevice> nd) = 0;
+ virtual void EnableAsciiInternal (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<NetDevice> nd) = 0;
/**
* @brief Enable ascii trace output on the indicated net device.
@@ -437,11 +437,11 @@
/**
* @brief Enable ascii trace output on the indicated net device.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param nd Net device for which you want to enable tracing.
*/
- void EnableAscii (Ptr<OutputStreamObject> stream, Ptr<NetDevice> nd);
+ void EnableAscii (Ptr<OutputStreamKeeper> stream, Ptr<NetDevice> nd);
/**
* @brief Enable ascii trace output the indicated net device using a device
@@ -456,11 +456,11 @@
* @brief Enable ascii trace output the indicated net device using a device
* previously named using the ns-3 object name service.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param ndName The name of the net device in which you want to enable tracing.
*/
- void EnableAscii (Ptr<OutputStreamObject> stream, std::string ndName);
+ void EnableAscii (Ptr<OutputStreamKeeper> stream, std::string ndName);
/**
* @brief Enable ascii trace output on each device in the container which is
@@ -475,11 +475,11 @@
* @brief Enable ascii trace output on each device in the container which is
* of the appropriate type.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param d container of devices of type ns3::CsmaNetDevice
*/
- void EnableAscii (Ptr<OutputStreamObject> stream, NetDeviceContainer d);
+ void EnableAscii (Ptr<OutputStreamKeeper> stream, NetDeviceContainer d);
/**
* @brief Enable ascii trace output on each device (which is of the
@@ -494,11 +494,11 @@
* @brief Enable ascii trace output on each device (which is of the
* appropriate type) in the nodes provided in the container.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* \param n container of nodes.
*/
- void EnableAscii (Ptr<OutputStreamObject> stream, NodeContainer n);
+ void EnableAscii (Ptr<OutputStreamKeeper> stream, NodeContainer n);
/**
* @brief Enable ascii trace output on each device (which is of the
@@ -512,10 +512,10 @@
* @brief Enable ascii trace output on each device (which is of the
* appropriate type) in the set of all nodes created in the simulation.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
*/
- void EnableAsciiAll (Ptr<OutputStreamObject> stream);
+ void EnableAsciiAll (Ptr<OutputStreamKeeper> stream);
/**
* @brief Enable ascii trace output on the device specified by a global
@@ -533,40 +533,40 @@
* @brief Enable ascii trace output on the device specified by a global
* node-id (of a previously created node) and associated device-id.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param nodeid The node identifier/number of the node on which to enable
* ascii tracing
* @param deviceid The device identifier/index of the device on which to enable
* ascii tracing
*/
- void EnableAscii (Ptr<OutputStreamObject> stream, uint32_t nodeid, uint32_t deviceid);
+ void EnableAscii (Ptr<OutputStreamKeeper> stream, uint32_t nodeid, uint32_t deviceid);
private:
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, uint32_t nodeid, uint32_t deviceid);
+ void EnableAsciiImpl (Ptr<OutputStreamKeeper> stream, std::string prefix, uint32_t nodeid, uint32_t deviceid);
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, NodeContainer n);
+ void EnableAsciiImpl (Ptr<OutputStreamKeeper> stream, std::string prefix, NodeContainer n);
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, NetDeviceContainer d);
+ void EnableAsciiImpl (Ptr<OutputStreamKeeper> stream, std::string prefix, NetDeviceContainer d);
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, std::string ndName);
+ void EnableAsciiImpl (Ptr<OutputStreamKeeper> stream, std::string prefix, std::string ndName);
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<NetDevice> nd);
+ void EnableAsciiImpl (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<NetDevice> nd);
};
@@ -654,8 +654,8 @@
* @brief Enable ascii trace output on the indicated Ipv4 and interface pair.
* @internal
*
- * The implementation is expected to use a provided Ptr<OutputStreamObject>
- * if it is non-null. If the OutputStreamObject is null, the implementation
+ * The implementation is expected to use a provided Ptr<OutputStreamKeeper>
+ * if it is non-null. If the OutputStreamKeeper is null, the implementation
* is expected to use a provided prefix to construct a new file name for
* each net device using the rules described in the class overview.
*
@@ -668,13 +668,13 @@
* context could be important, so the helper implementation is expected to
* TraceConnect.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param prefix Filename prefix to use for ascii trace files.
* @param ipv4 Ptr<Ipv4> on which you want to enable tracing.
* @param interface The interface on which you want to enable tracing.
*/
- virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamObject> stream, std::string prefix,
+ virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamKeeper> stream, std::string prefix,
Ptr<Ipv4> ipv4, uint32_t interface) = 0;
/**
@@ -689,12 +689,12 @@
/**
* @brief Enable ascii trace output on the indicated Ipv4 and interface pair.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param ipv4 Ptr<Ipv4> on which you want to enable tracing.
* @param interface The interface on which you want to enable tracing.
*/
- void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, Ptr<Ipv4> ipv4, uint32_t interface);
+ void EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, Ptr<Ipv4> ipv4, uint32_t interface);
/**
* @brief Enable ascii trace output the indicated Ipv4 and interface pair
@@ -710,12 +710,12 @@
* @brief Enable ascii trace output the indicated net device using a device
* previously named using the ns-3 object name service.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param ipv4Name The name of the Ipv4 on which you want to enable tracing.
* @param interface The interface on which you want to enable tracing.
*/
- void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, std::string ipv4Name, uint32_t interface);
+ void EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, std::string ipv4Name, uint32_t interface);
/**
* @brief Enable ascii trace output on each Ipv4 and interface pair in the
@@ -731,12 +731,12 @@
* @brief Enable ascii trace output on each device in the container which is
* of the appropriate type.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param c Ipv4InterfaceContainer of Ipv4 and interface pairs on which to
* enable tracing.
*/
- void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, Ipv4InterfaceContainer c);
+ void EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, Ipv4InterfaceContainer c);
/**
* @brief Enable ascii trace output on all Ipv4 and interface pairs existing
@@ -751,11 +751,11 @@
* @brief Enable ascii trace output on all Ipv4 and interface pairs existing
* in the nodes provided in the container.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* \param n container of nodes.
*/
- void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, NodeContainer n);
+ void EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, NodeContainer n);
/**
* @brief Enable ascii trace output on all Ipv4 and interface pairs existing
@@ -769,10 +769,10 @@
* @brief Enable ascii trace output on each device (which is of the
* appropriate type) in the set of all nodes created in the simulation.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
*/
- void EnableAsciiIpv4All (Ptr<OutputStreamObject> stream);
+ void EnableAsciiIpv4All (Ptr<OutputStreamKeeper> stream);
/**
* @brief Enable pcap output on the Ipv4 and interface pair specified by a
@@ -794,39 +794,39 @@
* can be only one Ipv4 aggregated to a node, the node-id unambiguously
* determines the Ipv4.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param nodeid The node identifier/number of the node on which to enable
* ascii tracing
* @param interface The interface on which you want to enable tracing.
*/
- void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, uint32_t nodeid, uint32_t interface);
+ void EnableAsciiIpv4 (Ptr<OutputStreamKeeper> stream, uint32_t nodeid, uint32_t interface);
private:
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiIpv4Impl (Ptr<OutputStreamObject> stream, std::string prefix, uint32_t nodeid, uint32_t interface);
+ void EnableAsciiIpv4Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, uint32_t nodeid, uint32_t interface);
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiIpv4Impl (Ptr<OutputStreamObject> stream, std::string prefix, NodeContainer n);
+ void EnableAsciiIpv4Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, NodeContainer n);
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiIpv4Impl (Ptr<OutputStreamObject> stream, std::string prefix, Ipv4InterfaceContainer c);
+ void EnableAsciiIpv4Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, Ipv4InterfaceContainer c);
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiIpv4Impl (Ptr<OutputStreamObject> stream, std::string prefix, std::string ipv4Name, uint32_t interface);
+ void EnableAsciiIpv4Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, std::string ipv4Name, uint32_t interface);
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiIpv4Impl (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<Ipv4> ipv4, uint32_t interface);
+ void EnableAsciiIpv4Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<Ipv4> ipv4, uint32_t interface);
};
@@ -913,8 +913,8 @@
* @brief Enable ascii trace output on the indicated Ipv6 and interface pair.
* @internal
*
- * The implementation is expected to use a provided Ptr<OutputStreamObject>
- * if it is non-null. If the OutputStreamObject is null, the implementation
+ * The implementation is expected to use a provided Ptr<OutputStreamKeeper>
+ * if it is non-null. If the OutputStreamKeeper is null, the implementation
* is expected to use a provided prefix to construct a new file name for
* each net device using the rules described in the class overview.
*
@@ -927,13 +927,13 @@
* context could be important, so the helper implementation is expected to
* TraceConnect.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param prefix Filename prefix to use for ascii trace files.
* @param ipv6 Ptr<Ipv6> on which you want to enable tracing.
* @param interface The interface on which you want to enable tracing.
*/
- virtual void EnableAsciiIpv6Internal (Ptr<OutputStreamObject> stream, std::string prefix,
+ virtual void EnableAsciiIpv6Internal (Ptr<OutputStreamKeeper> stream, std::string prefix,
Ptr<Ipv6> ipv6, uint32_t interface) = 0;
/**
@@ -949,12 +949,12 @@
/**
* @brief Enable ascii trace output on the indicated Ipv6 and interface pair.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param ipv6 Ptr<Ipv6> on which you want to enable tracing.
* @param interface The interface on which you want to enable tracing.
*/
- void EnableAsciiIpv6 (Ptr<OutputStreamObject> stream,
+ void EnableAsciiIpv6 (Ptr<OutputStreamKeeper> stream,
Ptr<Ipv6> ipv6, uint32_t interface);
/**
@@ -972,12 +972,12 @@
* @brief Enable ascii trace output the indicated net device using a device
* previously named using the ns-3 object name service.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param ipv6Name The name of the Ipv6 on which you want to enable tracing.
* @param interface The interface on which you want to enable tracing.
*/
- void EnableAsciiIpv6 (Ptr<OutputStreamObject> stream,
+ void EnableAsciiIpv6 (Ptr<OutputStreamKeeper> stream,
std::string ipv6Name, uint32_t interface);
/**
@@ -994,12 +994,12 @@
* @brief Enable ascii trace output on each device in the container which is
* of the appropriate type.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param c Ipv6InterfaceContainer of Ipv6 and interface pairs on which to
* enable tracing.
*/
- void EnableAsciiIpv6 (Ptr<OutputStreamObject> stream, Ipv6InterfaceContainer c);
+ void EnableAsciiIpv6 (Ptr<OutputStreamKeeper> stream, Ipv6InterfaceContainer c);
/**
* @brief Enable ascii trace output on all Ipv6 and interface pairs existing
@@ -1014,11 +1014,11 @@
* @brief Enable ascii trace output on all Ipv6 and interface pairs existing
* in the nodes provided in the container.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* \param n container of nodes.
*/
- void EnableAsciiIpv6 (Ptr<OutputStreamObject> stream, NodeContainer n);
+ void EnableAsciiIpv6 (Ptr<OutputStreamKeeper> stream, NodeContainer n);
/**
* @brief Enable pcap output on the Ipv6 and interface pair specified by a
@@ -1040,13 +1040,13 @@
* can be only one Ipv6 aggregated to a node, the node-id unambiguously
* determines the Ipv6.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
* @param nodeid The node identifier/number of the node on which to enable
* ascii tracing
* @param interface The interface on which you want to enable tracing.
*/
- void EnableAsciiIpv6 (Ptr<OutputStreamObject> stream, uint32_t nodeid, uint32_t interface);
+ void EnableAsciiIpv6 (Ptr<OutputStreamKeeper> stream, uint32_t nodeid, uint32_t interface);
/**
* @brief Enable ascii trace output on all Ipv6 and interface pairs existing
@@ -1060,36 +1060,36 @@
* @brief Enable ascii trace output on each device (which is of the
* appropriate type) in the set of all nodes created in the simulation.
*
- * @param stream An OutputStreamObject representing an existing file to use
+ * @param stream An OutputStreamKeeper representing an existing file to use
* when writing trace data.
*/
- void EnableAsciiIpv6All (Ptr<OutputStreamObject> stream);
+ void EnableAsciiIpv6All (Ptr<OutputStreamKeeper> stream);
private:
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiIpv6Impl (Ptr<OutputStreamObject> stream, std::string prefix, uint32_t nodeid, uint32_t interface);
+ void EnableAsciiIpv6Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, uint32_t nodeid, uint32_t interface);
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiIpv6Impl (Ptr<OutputStreamObject> stream, std::string prefix, NodeContainer n);
+ void EnableAsciiIpv6Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, NodeContainer n);
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiIpv6Impl (Ptr<OutputStreamObject> stream, std::string prefix, Ipv6InterfaceContainer c);
+ void EnableAsciiIpv6Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, Ipv6InterfaceContainer c);
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiIpv6Impl (Ptr<OutputStreamObject> stream, std::string prefix, std::string ipv6Name, uint32_t interface);
+ void EnableAsciiIpv6Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, std::string ipv6Name, uint32_t interface);
/**
* @internal Avoid code duplication.
*/
- void EnableAsciiIpv6Impl (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<Ipv6> ipv6, uint32_t interface);
+ void EnableAsciiIpv6Impl (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<Ipv6> ipv6, uint32_t interface);
};
--- a/src/helper/wifi-helper.cc Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/wifi-helper.cc Fri Feb 12 17:31:11 2010 -0800
@@ -30,7 +30,6 @@
#include "ns3/propagation-loss-model.h"
#include "ns3/mobility-model.h"
#include "ns3/log.h"
-#include "ns3/pcap-writer.h"
#include "ns3/config.h"
#include "ns3/simulator.h"
#include "ns3/names.h"
--- a/src/helper/yans-wifi-helper.cc Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/yans-wifi-helper.cc Fri Feb 12 17:31:11 2010 -0800
@@ -27,8 +27,6 @@
#include "ns3/yans-wifi-phy.h"
#include "ns3/wifi-net-device.h"
#include "ns3/radiotap-header.h"
-#include "ns3/pcap-writer.h"
-#include "ns3/ascii-writer.h"
#include "ns3/pcap-file-object.h"
#include "ns3/simulator.h"
#include "ns3/config.h"
@@ -42,7 +40,7 @@
static void
AsciiPhyTransmitSinkWithContext (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
std::string context,
Ptr<const Packet> p,
WifiMode mode,
@@ -55,7 +53,7 @@
static void
AsciiPhyTransmitSinkWithoutContext (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
Ptr<const Packet> p,
WifiMode mode,
WifiPreamble preamble,
@@ -67,7 +65,7 @@
static void
AsciiPhyReceiveSinkWithContext (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
std::string context,
Ptr<const Packet> p,
double snr,
@@ -80,7 +78,7 @@
static void
AsciiPhyReceiveSinkWithoutContext (
- Ptr<OutputStreamObject> stream,
+ Ptr<OutputStreamKeeper> stream,
Ptr<const Packet> p,
double snr,
WifiMode mode,
@@ -409,7 +407,7 @@
}
void
-YansWifiPhyHelper::EnableAsciiInternal (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<NetDevice> nd)
+YansWifiPhyHelper::EnableAsciiInternal (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<NetDevice> nd)
{
//
// All of the ascii enable functions vector through here including the ones
@@ -434,7 +432,7 @@
std::ostringstream oss;
//
- // If we are not provided an OutputStreamObject, we are expected to create
+ // If we are not provided an OutputStreamKeeper, we are expected to create
// one using the usual trace filename conventions and write our traces
// without a context since there will be one file per context and therefore
// the context would be redundant.
@@ -448,7 +446,7 @@
//
AsciiTraceHelper asciiTraceHelper;
std::string filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device);
- Ptr<OutputStreamObject> theStream = asciiTraceHelper.CreateFileStream (filename, "w");
+ Ptr<OutputStreamKeeper> theStream = asciiTraceHelper.CreateFileStream (filename, "w");
//
// We could go poking through the phy and the state looking for the
@@ -468,7 +466,7 @@
}
//
- // If we are provided an OutputStreamObject, we are expected to use it, and
+ // If we are provided an OutputStreamKeeper, we are expected to use it, and
// to provide a context. We are free to come up with our own context if we
// want, and use the AsciiTraceHelper Hook*WithContext functions, but for
// compatibility and simplicity, we just use Config::Connect and let it deal
--- a/src/helper/yans-wifi-helper.h Fri Feb 12 16:44:15 2010 -0800
+++ b/src/helper/yans-wifi-helper.h Fri Feb 12 17:31:11 2010 -0800
@@ -256,7 +256,7 @@
* \param prefix Filename prefix to use for ascii trace files.
* \param nd Net device for which you want to enable tracing.
*/
- virtual void EnableAsciiInternal (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<NetDevice> nd);
+ virtual void EnableAsciiInternal (Ptr<OutputStreamKeeper> stream, std::string prefix, Ptr<NetDevice> nd);
ObjectFactory m_phy;
ObjectFactory m_errorRateModel;