--- a/SConstruct Mon Sep 04 13:40:02 2006 +0200
+++ b/SConstruct Mon Sep 04 14:06:00 2006 +0200
@@ -534,7 +534,6 @@
'chunk-constant-data.cc',
'packet.cc',
'tags.cc',
- 'packet-logger.cc',
'pcap-writer.cc',
'trace-container.cc',
'traced-variable-test.cc',
@@ -549,9 +548,8 @@
'ui-traced-variable.tcc',
'si-traced-variable.tcc',
'f-traced-variable.tcc',
- 'callback-logger.h',
+ 'callback-tracer.h',
'trace-container.h',
- 'packet-logger.h',
'chunk-constant-data.h',
'trace-stream.h',
'pcap-writer.h',
--- a/samples/main-trace.cc Mon Sep 04 13:40:02 2006 +0200
+++ b/samples/main-trace.cc Mon Sep 04 14:06:00 2006 +0200
@@ -1,6 +1,7 @@
/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
#include "ns3/trace-container.h"
#include "ns3/ui-traced-variable.tcc"
+#include "ns3/callback-tracer.h"
#include "ns3/trace-stream.h"
#include "ns3/pcap-writer.h"
#include "ns3/packet.h"
@@ -8,10 +9,10 @@
using namespace ns3;
-CallbackLogger<Packet> a;
+CallbackTracer<Packet> a;
UiTracedVariable<unsigned short> b;
TraceStream c;
-CallbackLogger<double, int> d;
+CallbackTracer<double, int> d;
void
register_all_trace_sources (TraceContainer *container)
--- a/src/common/callback-logger.h Mon Sep 04 13:40:02 2006 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
-/*
- * Copyright (c) 2005,2006 INRIA
- * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-#ifndef CALLBACK_LOGGER_H
-#define CALLBACK_LOGGER_H
-
-#include "ns3/callback.h"
-
-namespace ns3 {
-
-class CallbackLoggerBase {};
-
-/**
- * \brief log arbitrary number of parameters to a matching ns3::Callback
- *
- * Whenever operator () is invoked on this class, the call and its arguments
- * are forwarded to the internal matching ns3::Callback.
- */
-template<typename T1 = empty, typename T2 = empty,
- typename T3 = empty, typename T4 = empty,
- typename T5 = empty>
-class CallbackLogger : public CallbackLoggerBase{
-public:
- CallbackLogger ()
- : m_callback () {}
- void set_callback (Callback<void,T1,T2,T3,T4,T5> callback) {
- m_callback = callback;
- }
- void operator() (void) {
- if (!m_callback.is_null ()) {
- m_callback ();
- }
- }
- void operator() (T1 a1) {
- if (!m_callback.is_null ()) {
- m_callback (a1);
- }
- }
- void operator() (T1 a1, T2 a2) {
- if (!m_callback.is_null ()) {
- m_callback (a1,a2);
- }
- }
- void operator() (T1 a1, T2 a2, T3 a3) {
- if (!m_callback.is_null ()) {
- m_callback (a1,a2,a3);
- }
- }
- void operator() (T1 a1, T2 a2, T3 a3, T4 a4) {
- if (!m_callback.is_null ()) {
- m_callback (a1,a2,a3,a4);
- }
- }
- void operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5) {
- if (!m_callback.is_null ()) {
- m_callback (a1,a2,a3,a4,a5);
- }
- }
-
-private:
- Callback<void,T1,T2,T3,T4,T5> m_callback;
-};
-
-}; // namespace ns3
-
-#endif /* CALLBACK_LOGGER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/common/callback-tracer.h Mon Sep 04 14:06:00 2006 +0200
@@ -0,0 +1,84 @@
+/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
+/*
+ * Copyright (c) 2005,2006 INRIA
+ * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+
+#ifndef CALLBACK_TRACER_H
+#define CALLBACK_TRACER_H
+
+#include "ns3/callback.h"
+
+namespace ns3 {
+
+class CallbackTracerBase {};
+
+/**
+ * \brief log arbitrary number of parameters to a matching ns3::Callback
+ *
+ * Whenever operator () is invoked on this class, the call and its arguments
+ * are forwarded to the internal matching ns3::Callback.
+ */
+template<typename T1 = empty, typename T2 = empty,
+ typename T3 = empty, typename T4 = empty,
+ typename T5 = empty>
+class CallbackTracer : public CallbackTracerBase{
+public:
+ CallbackTracer ()
+ : m_callback () {}
+ void set_callback (Callback<void,T1,T2,T3,T4,T5> callback) {
+ m_callback = callback;
+ }
+ void operator() (void) {
+ if (!m_callback.is_null ()) {
+ m_callback ();
+ }
+ }
+ void operator() (T1 a1) {
+ if (!m_callback.is_null ()) {
+ m_callback (a1);
+ }
+ }
+ void operator() (T1 a1, T2 a2) {
+ if (!m_callback.is_null ()) {
+ m_callback (a1,a2);
+ }
+ }
+ void operator() (T1 a1, T2 a2, T3 a3) {
+ if (!m_callback.is_null ()) {
+ m_callback (a1,a2,a3);
+ }
+ }
+ void operator() (T1 a1, T2 a2, T3 a3, T4 a4) {
+ if (!m_callback.is_null ()) {
+ m_callback (a1,a2,a3,a4);
+ }
+ }
+ void operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5) {
+ if (!m_callback.is_null ()) {
+ m_callback (a1,a2,a3,a4,a5);
+ }
+ }
+
+private:
+ Callback<void,T1,T2,T3,T4,T5> m_callback;
+};
+
+}; // namespace ns3
+
+#endif /* CALLBACK_TRACER_H */
--- a/src/common/trace-container.cc Mon Sep 04 13:40:02 2006 +0200
+++ b/src/common/trace-container.cc Mon Sep 04 14:06:00 2006 +0200
@@ -119,7 +119,7 @@
}
void
-TraceContainer::register_callback (char const *name, CallbackLoggerBase *logger)
+TraceContainer::register_callback (char const *name, CallbackTracerBase *tracer)
{
for (CallbackListI i = m_callback_list.begin (); i != m_callback_list.end (); i++) {
if (i->second == name) {
@@ -127,7 +127,7 @@
break;
}
}
- m_callback_list.push_back (std::make_pair (logger, name));
+ m_callback_list.push_back (std::make_pair (tracer, name));
}
--- a/src/common/trace-container.h Mon Sep 04 13:40:02 2006 +0200
+++ b/src/common/trace-container.h Mon Sep 04 14:06:00 2006 +0200
@@ -25,7 +25,7 @@
#include "ui-traced-variable.tcc"
#include "si-traced-variable.tcc"
#include "f-traced-variable.tcc"
-#include "callback-logger.h"
+#include "callback-tracer.h"
#include "ns3/callback.h"
#include <list>
#include <string>
@@ -44,7 +44,7 @@
*
* TraceContainer can be used to register the following event sources:
* - ns3::TraceStream : can be connected to any std::ostream
- * - ns3::CallbackLogger: can be connected to any ns3::Callback
+ * - ns3::CallbackTracer: can be connected to any ns3::Callback
* - ns3::UiTracedVariable
* - ns3::SiTracedVariable
* - ns3::FTracedVariable
@@ -97,7 +97,7 @@
* \param name the name of the target event source
* \param callback the callback being connected to the target event source.
*
- * This method targets only event sources which are of type CallbackLogger<T1>
+ * This method targets only event sources which are of type CallbackTracer<T1>
*/
template <typename T1>
void set_callback (char const *name, Callback<void,T1> callback);
@@ -105,7 +105,7 @@
* \param name the name of the target event source
* \param callback the callback being connected to the target event source.
*
- * This method targets only event sources which are of type CallbackLogger<T1,T2>
+ * This method targets only event sources which are of type CallbackTracer<T1,T2>
*/
template <typename T1, typename T2>
void set_callback (char const *name, Callback<void,T1,T2> callback);
@@ -113,7 +113,7 @@
* \param name the name of the target event source
* \param callback the callback being connected to the target event source.
*
- * This method targets only event sources which are of type CallbackLogger<T1,T2,T3>
+ * This method targets only event sources which are of type CallbackTracer<T1,T2,T3>
*/
template <typename T1, typename T2, typename T3>
void set_callback (char const *name, Callback<void,T1,T2,T3> callback);
@@ -121,7 +121,7 @@
* \param name the name of the target event source
* \param callback the callback being connected to the target event source.
*
- * This method targets only event sources which are of type CallbackLogger<T1,T2,T3,T4>
+ * This method targets only event sources which are of type CallbackTracer<T1,T2,T3,T4>
*/
template <typename T1, typename T2, typename T3, typename T4>
void set_callback (char const *name, Callback<void,T1,T2,T3,T4> callback);
@@ -129,7 +129,7 @@
* \param name the name of the target event source
* \param callback the callback being connected to the target event source.
*
- * This method targets only event sources which are of type CallbackLogger<T1,T2,T3,T4,T5>
+ * This method targets only event sources which are of type CallbackTracer<T1,T2,T3,T4,T5>
*/
template <typename T1, typename T2, typename T3, typename T4, typename T5>
void set_callback (char const *name, Callback<void,T1,T2,T3,T4,T5> callback);
@@ -165,11 +165,11 @@
/**
* \param name the name of the registeref event source
- * \param logger the callback logger being registered.
+ * \param tracer the callback tracer being registered.
*
- * This method registers only event sources of type CallbackLogger
+ * This method registers only event sources of type CallbackTracer
*/
- void register_callback (char const *name, CallbackLoggerBase*logger);
+ void register_callback (char const *name, CallbackTracerBase*tracer);
/**
* Print the list of registered event sources in this container only.
@@ -184,8 +184,8 @@
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<CallbackLoggerBase *, std::string> > CallbackList;
- typedef std::list<std::pair<CallbackLoggerBase *, std::string> >::iterator CallbackListI;
+ 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;
@@ -208,7 +208,7 @@
{
for (CallbackListI i = m_callback_list.begin (); i != m_callback_list.end (); i++) {
if (i->second == name) {
- static_cast<CallbackLogger<T1> *> (i->first)->set_callback (callback);
+ static_cast<CallbackTracer<T1> *> (i->first)->set_callback (callback);
return;
}
}
@@ -222,7 +222,7 @@
{
for (CallbackListI i = m_callback_list.begin (); i != m_callback_list.end (); i++) {
if (i->second == name) {
- static_cast<CallbackLogger<T1,T2> *> (i->first)->set_callback (callback);
+ static_cast<CallbackTracer<T1,T2> *> (i->first)->set_callback (callback);
return;
}
}
@@ -236,7 +236,7 @@
{
for (CallbackListI i = m_callback_list.begin (); i != m_callback_list.end (); i++) {
if (i->second == name) {
- static_cast<CallbackLogger<T1,T2,T3> *> (i->first)->set_callback (callback);
+ static_cast<CallbackTracer<T1,T2,T3> *> (i->first)->set_callback (callback);
return;
}
}
@@ -250,7 +250,7 @@
{
for (CallbackListI i = m_callback_list.begin (); i != m_callback_list.end (); i++) {
if (i->second == name) {
- static_cast<CallbackLogger<T1,T2,T3,T4> *> (i->first)->set_callback (callback);
+ static_cast<CallbackTracer<T1,T2,T3,T4> *> (i->first)->set_callback (callback);
return;
}
}
@@ -264,7 +264,7 @@
{
for (CallbackListI i = m_callback_list.begin (); i != m_callback_list.end (); i++) {
if (i->second == name) {
- static_cast<CallbackLogger<T1,T2,T3,T4,T5> *> (i->first)->set_callback (callback);
+ static_cast<CallbackTracer<T1,T2,T3,T4,T5> *> (i->first)->set_callback (callback);
return;
}
}