--- a/SConstruct Thu Mar 29 18:07:37 2007 +0200
+++ b/SConstruct Thu Mar 29 22:39:11 2007 +0200
@@ -145,7 +145,6 @@
'packet.cc',
'tags.cc',
'pcap-writer.cc',
- 'trace-writer.cc',
'variable-tracer-test.cc',
'trace-context.cc',
'trace-resolver.cc',
@@ -166,7 +165,6 @@
'uv-trace-source.h',
'sv-trace-source.h',
'fv-trace-source.h',
- 'trace-writer.h',
'pcap-writer.h',
'callback-trace-source.h',
'trace-context.h',
--- a/samples/main-p2p-net-device-if.cc Thu Mar 29 18:07:37 2007 +0200
+++ b/samples/main-p2p-net-device-if.cc Thu Mar 29 22:39:11 2007 +0200
@@ -21,6 +21,7 @@
#include <list>
#include <cassert>
#endif
+#include <fstream>
#include "ns3/debug.h"
#include "ns3/internet-node.h"
@@ -29,7 +30,6 @@
#include "ns3/ipv4-address.h"
#include "ns3/p2p-channel.h"
#include "ns3/p2p-net-device.h"
-#include "ns3/trace-writer.h"
#include "ns3/drop-tail.h"
#include "ns3/arp-ipv4-interface.h"
#include "ns3/ipv4.h"
@@ -42,23 +42,13 @@
using namespace ns3;
-class Logger : public TraceWriter{
+class Logger {
public:
- Logger ()
- {
- NS_DEBUG_UNCOND("**** Logger()");
- }
Logger (std::string const &filename)
{
+ m_filestr.open (filename.c_str ());
NS_DEBUG_UNCOND("**** Logger(string const &)");
- Open(filename);
- }
-
- Logger (char const *filename) : m_tracer(filename)
- {
- NS_DEBUG_UNCOND("**** Logger(char const *)");
- Open(filename);
}
~Logger () {}
@@ -89,7 +79,7 @@
}
protected:
- TraceWriter m_tracer;
+ std::ofstream m_filestr;;
};
static void
--- a/src/common/trace-writer.cc Thu Mar 29 18:07:37 2007 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 University of Washington
- * All rights reserved.
- *
- * 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
- *
- * Author: Craig Dowell <craigdo@ee.washingon.edu>
- *
- * Thu Feb 8 10:42:52 PST 2007 craigdo: Created from pcap-writer.c
- */
-
-#include "ns3/debug.h"
-#include "trace-writer.h"
-
-NS_DEBUG_COMPONENT_DEFINE ("TraceWriter");
-
-namespace ns3 {
-
-TraceWriter::TraceWriter () :
- m_filestr()
-{
- NS_DEBUG ("TraceWriter()::TraceWriter()");
-
- std::streambuf *sb = m_filestr.rdbuf();
-
- NS_DEBUG ("TraceWriter()::TraceWriter(): rdbuf ()");
- rdbuf(sb);
-
- NS_DEBUG ("TraceWriter()::TraceWriter(): done");
-}
-
- TraceWriter::TraceWriter (std::string const &filename) :
- m_filestr()
-{
- NS_DEBUG ("TraceWriter()::TraceWriter (\"" << filename << "\")");
-
- m_filestr.open (filename.c_str(), std::ios::out | std::ios::app);
-
- std::streambuf *sb = m_filestr.rdbuf();
-
- NS_DEBUG ("TraceWriter()::TraceWriter(): rdbuf ()");
- rdbuf(sb);
-
- NS_DEBUG ("TraceWriter()::TraceWriter(): done");
-}
-
-TraceWriter::TraceWriter (char const *filename) :
- m_filestr()
-{
- NS_DEBUG ("TraceWriter()::TraceWriter (\"" << filename << "\")");
-
- m_filestr.open (filename, std::ios::out | std::ios::app);
-
- std::streambuf *sb = m_filestr.rdbuf();
-
- NS_DEBUG ("TraceWriter()::TraceWriter(): rdbuf ()");
- rdbuf(sb);
-
- NS_DEBUG ("TraceWriter()::TraceWriter(): done");
-}
-
-
-TraceWriter::~TraceWriter ()
-{
- NS_DEBUG ("TraceWriter()::~TraceWriter()");
-}
-
- void
-TraceWriter::Open (std::string const &filename)
-{
- NS_DEBUG ("TraceWriter()::Open (\"" << filename << "\")");
-
- m_filestr.open (filename.c_str(), std::ios::out);
-}
-
- void
-TraceWriter::Open (char const *filename)
-{
- NS_DEBUG ("TraceWriter()::Open (\"" << filename << "\")");
-
- m_filestr.open (filename, std::ios::out);
-}
-
- void
-TraceWriter::Close ()
-{
- NS_DEBUG ("TraceWriter()::Close ()");
-
- m_filestr.close ();
-}
-
- void
-TraceWriter::Write (std::string const &str)
-{
- NS_DEBUG ("TraceWriter()::Write (\"" << str << "\")");
-
- m_filestr << str;
-}
-
-}; // namespace ns3
--- a/src/common/trace-writer.h Thu Mar 29 18:07:37 2007 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 University of Washington
- * All rights reserved.
- *
- * 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
- *
- * Author: Craig Dowell <craigdo@ee.washingon.edu>
- *
- * Thu Feb 8 10:41:40 PST 2007 craigdo: Created
- */
-
-#ifndef TRACE_WRITER_H
-#define TRACE_WRITER_H
-
-#include <iostream>
-#include <fstream>
-#include <streambuf>
-#include <string>
-#include "ns3/callback.h"
-
-namespace ns3 {
-
-class TraceWriter : public std::ostream {
-public:
- TraceWriter ();
- TraceWriter (std::string const &filename);
- TraceWriter (char const *filename);
-
- ~TraceWriter ();
-
- void Open (std::string const &filename);
- void Open (char const *filename);
- void Close ();
-
- /**
- * \param String to write to output file
- */
- void Write (std::string const &str);
-
-protected:
- std::ofstream m_filestr;
- void Init (const char *filename);
-};
-
-}; // namespace ns3
-
-#endif /* TRACE_WRITER_H */