rename trace stream to stream tracer
This commit is contained in:
@@ -537,7 +537,7 @@ common.add_sources ([
|
||||
'pcap-writer.cc',
|
||||
'trace-container.cc',
|
||||
'traced-variable-test.cc',
|
||||
'trace-stream-test.cc',
|
||||
'stream-tracer-test.cc',
|
||||
])
|
||||
common.add_inst_headers ([
|
||||
'buffer.h',
|
||||
@@ -549,9 +549,9 @@ common.add_inst_headers ([
|
||||
'si-traced-variable.tcc',
|
||||
'f-traced-variable.tcc',
|
||||
'callback-tracer.h',
|
||||
'stream-tracer.h',
|
||||
'trace-container.h',
|
||||
'chunk-constant-data.h',
|
||||
'trace-stream.h',
|
||||
'pcap-writer.h',
|
||||
])
|
||||
common.add_headers ([
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "ns3/trace-container.h"
|
||||
#include "ns3/ui-traced-variable.tcc"
|
||||
#include "ns3/callback-tracer.h"
|
||||
#include "ns3/trace-stream.h"
|
||||
#include "ns3/stream-tracer.h"
|
||||
#include "ns3/pcap-writer.h"
|
||||
#include "ns3/packet.h"
|
||||
#include <iostream>
|
||||
@@ -11,7 +11,7 @@ using namespace ns3;
|
||||
|
||||
CallbackTracer<Packet> a;
|
||||
UiTracedVariable<unsigned short> b;
|
||||
TraceStream c;
|
||||
StreamTracer c;
|
||||
CallbackTracer<double, int> d;
|
||||
|
||||
void
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#include "trace-stream.h"
|
||||
#include "stream-tracer.h"
|
||||
#include "ns3/test.h"
|
||||
#include <iostream>
|
||||
|
||||
@@ -26,23 +26,23 @@
|
||||
|
||||
namespace {
|
||||
|
||||
class TestTraceStream : public ns3::Test {
|
||||
class TestStreamTracer : public ns3::Test {
|
||||
public:
|
||||
TestTraceStream ();
|
||||
TestStreamTracer ();
|
||||
virtual bool run_tests (void);
|
||||
};
|
||||
|
||||
static TestTraceStream g_test_stream;
|
||||
static TestStreamTracer g_test_stream;
|
||||
|
||||
TestTraceStream::TestTraceStream ()
|
||||
: Test ("TraceStream")
|
||||
TestStreamTracer::TestStreamTracer ()
|
||||
: Test ("StreamTracer")
|
||||
{}
|
||||
|
||||
bool
|
||||
TestTraceStream::run_tests (void)
|
||||
TestStreamTracer::run_tests (void)
|
||||
{
|
||||
bool ok = true;
|
||||
ns3::TraceStream trace;
|
||||
ns3::StreamTracer trace;
|
||||
//trace.set_stream (&std::cout);
|
||||
trace << 1;
|
||||
trace << " X ";
|
||||
@@ -18,8 +18,8 @@
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#ifndef TRACE_STREAM_H
|
||||
#define TRACE_STREAM_H
|
||||
#ifndef STREAM_TRACER_H
|
||||
#define STREAM_TRACER_H
|
||||
|
||||
#include <ostream>
|
||||
|
||||
@@ -32,25 +32,25 @@ namespace ns3 {
|
||||
* it is forwarded to the stored std::ostream output
|
||||
* stream (if there is one).
|
||||
*/
|
||||
class TraceStream {
|
||||
class StreamTracer {
|
||||
public:
|
||||
TraceStream ()
|
||||
StreamTracer ()
|
||||
: m_os (0) {}
|
||||
template <typename T>
|
||||
TraceStream &operator << (T const&v) {
|
||||
StreamTracer &operator << (T const&v) {
|
||||
if (m_os != 0) {
|
||||
(*m_os) << v;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
template <typename T>
|
||||
TraceStream &operator << (T &v) {
|
||||
StreamTracer &operator << (T &v) {
|
||||
if (m_os != 0) {
|
||||
(*m_os) << v;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
TraceStream &operator << (std::ostream &(*v) (std::ostream &)) {
|
||||
StreamTracer &operator << (std::ostream &(*v) (std::ostream &)) {
|
||||
if (m_os != 0) {
|
||||
(*m_os) << v;
|
||||
}
|
||||
@@ -70,4 +70,4 @@ private:
|
||||
}; // namespace ns3
|
||||
|
||||
|
||||
#endif /* TRACE_STREAM_H */
|
||||
#endif /* TRACER_STREAM_H */
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "trace-container.h"
|
||||
#include "trace-stream.h"
|
||||
#include "stream-tracer.h"
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
@@ -65,7 +65,7 @@ TraceContainer::set_f_variable_callback (char const *name, Callback<void,double,
|
||||
void
|
||||
TraceContainer::set_stream (char const *name, std::ostream *os)
|
||||
{
|
||||
for (TraceStreamListI i = m_trace_stream_list.begin (); i != m_trace_stream_list.end (); i++) {
|
||||
for (StreamTracerListI i = m_trace_stream_list.begin (); i != m_trace_stream_list.end (); i++) {
|
||||
if ((*i).second == name) {
|
||||
(*i).first->set_stream (os);
|
||||
return;
|
||||
@@ -105,10 +105,10 @@ TraceContainer::register_f_variable (char const *name, FTracedVariableBase *var)
|
||||
}
|
||||
|
||||
void
|
||||
TraceContainer::register_stream (char const *name, TraceStream *stream)
|
||||
TraceContainer::register_stream (char const *name, StreamTracer *stream)
|
||||
{
|
||||
// ensure unicity
|
||||
for (TraceStreamListI i = m_trace_stream_list.begin (); i != m_trace_stream_list.end (); i++) {
|
||||
for (StreamTracerListI i = m_trace_stream_list.begin (); i != m_trace_stream_list.end (); i++) {
|
||||
if (i->second == name) {
|
||||
m_trace_stream_list.erase (i);
|
||||
break;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class TraceStream;
|
||||
class StreamTracer;
|
||||
|
||||
/**
|
||||
* \brief register every source of trace events
|
||||
@@ -43,7 +43,7 @@ class TraceStream;
|
||||
* model trace event sources.
|
||||
*
|
||||
* TraceContainer can be used to register the following event sources:
|
||||
* - ns3::TraceStream : can be connected to any std::ostream
|
||||
* - ns3::StreamTracer : can be connected to any std::ostream
|
||||
* - ns3::CallbackTracer: can be connected to any ns3::Callback
|
||||
* - ns3::UiTracedVariable
|
||||
* - ns3::SiTracedVariable
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
* \param name the name of the target event source
|
||||
* \param os the output stream being connected to the source trace stream
|
||||
*
|
||||
* This method targets only event sources which are of type TraceStream.
|
||||
* This method targets only event sources which are of type StreamTracer.
|
||||
*/
|
||||
void set_stream (char const *name, std::ostream *os);
|
||||
|
||||
@@ -159,9 +159,9 @@ public:
|
||||
* \param name the name of the registered event source
|
||||
* \param stream the event source being registered
|
||||
*
|
||||
* This method registers only event sources of type TraceStream.
|
||||
* This method registers only event sources of type StreamTracer.
|
||||
*/
|
||||
void register_stream (char const *name, TraceStream *stream);
|
||||
void register_stream (char const *name, StreamTracer *stream);
|
||||
|
||||
/**
|
||||
* \param name the name of the registeref event source
|
||||
@@ -182,15 +182,15 @@ private:
|
||||
typedef std::list<std::pair<SiTracedVariableBase *, std::string> >::iterator SiListI;
|
||||
typedef std::list<std::pair<FTracedVariableBase *, std::string> > FList;
|
||||
typedef std::list<std::pair<FTracedVariableBase *, std::string> >::iterator FListI;
|
||||
typedef std::list<std::pair<TraceStream *, std::string> > TraceStreamList;
|
||||
typedef std::list<std::pair<TraceStream *, std::string> >::iterator TraceStreamListI;
|
||||
typedef std::list<std::pair<StreamTracer *, std::string> > StreamTracerList;
|
||||
typedef std::list<std::pair<StreamTracer *, std::string> >::iterator StreamTracerListI;
|
||||
typedef std::list<std::pair<CallbackTracerBase *, std::string> > CallbackList;
|
||||
typedef std::list<std::pair<CallbackTracerBase *, std::string> >::iterator CallbackListI;
|
||||
|
||||
UiList m_ui_list;
|
||||
SiList m_si_list;
|
||||
FList m_f_list;
|
||||
TraceStreamList m_trace_stream_list;
|
||||
StreamTracerList m_trace_stream_list;
|
||||
CallbackList m_callback_list;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user