remove TraceRoot

This commit is contained in:
Mathieu Lacage
2007-08-27 13:36:40 +02:00
parent c1b38a9203
commit ccef3f6d9f
7 changed files with 39 additions and 431 deletions

View File

@@ -20,24 +20,12 @@
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
*/
#include "ns3/array-trace-resolver.h"
#include "ns3/trace-root.h"
#include "ns3/composite-trace-resolver.h"
#include "ns3/simulator.h"
#include "ns3/simulation-singleton.h"
#include "node-list.h"
#include "node.h"
namespace {
static class Initialization
{
public:
Initialization ()
{
ns3::TraceRoot::Register ("nodes", ns3::MakeCallback (&ns3::NodeList::GetTraceResolver));
}
} g_initialization;
}
namespace ns3 {
NodeListIndex::NodeListIndex ()
@@ -133,9 +121,8 @@ NodeListPriv::GetNode (uint32_t n)
Ptr<TraceResolver>
NodeListPriv::GetTraceResolver (void)
{
Ptr<ArrayTraceResolver<NodeListIndex> >resolver =
Create<ArrayTraceResolver<NodeListIndex> > ();
resolver->SetIterators (Begin (), End ());
Ptr<CompositeTraceResolver> resolver = Create<CompositeTraceResolver> ();
resolver->AddArray ("nodes", Begin (), End (), NodeListIndex ());
return resolver;
}
@@ -163,17 +150,21 @@ NodeList::End (void)
{
return SimulationSingleton<NodeListPriv>::Get ()->End ();
}
Ptr<TraceResolver>
NodeList::GetTraceResolver (void)
{
return SimulationSingleton<NodeListPriv>::Get ()->GetTraceResolver ();
}
Ptr<Node>
NodeList::GetNode (uint32_t n)
{
return SimulationSingleton<NodeListPriv>::Get ()->GetNode (n);
}
void
NodeList::Connect (std::string name, const CallbackBase &cb)
{
SimulationSingleton<NodeListPriv>::Get ()->GetTraceResolver ()->Connect (name, cb, TraceContext ());
}
void
NodeList::Disconnect (std::string name, const CallbackBase &cb)
{
SimulationSingleton<NodeListPriv>::Get ()->GetTraceResolver ()->Disconnect (name, cb);
}
}//namespace ns3

View File

@@ -29,8 +29,7 @@
namespace ns3 {
class Node;
class TraceResolver;
class TraceContext;
class CallbackBase;
class NodeListIndex : public TraceContextElement
{
@@ -73,19 +72,28 @@ public:
* list.
*/
static Iterator End (void);
/**
* \param context trace context to use for trace resolver
* to create.
* \returns the requested trace resolver. The caller
* takes ownership of the returned pointer.
*/
static Ptr<TraceResolver> GetTraceResolver (void);
/**
* \param n index of requested node.
* \returns the Node associated to index n.
*/
static Ptr<Node> GetNode (uint32_t n);
/**
* \param name namespace regexp to match
* \param cb callback to connect
*
* Connect input callback to all trace sources which match
* the input namespace regexp.
*/
static void Connect (std::string name, const CallbackBase &cb);
/**
* \param name namespace regexp to match
* \param cb callback to connect
*
* Disconnect input callback from all trace sources which match
* the input namespace regexp.
*/
static void Disconnect (std::string name, const CallbackBase &cb);
private:
};
}//namespace ns3