# HG changeset patch # User Mathieu Lacage # Date 1204494775 -3600 # Node ID 4e9ba43f7b9e19567d2fd9c3945f5f6892de318a # Parent aadaad12287cc10cb8a76be4b882778f31db7405 use Config-based trace system diff -r aadaad12287c -r 4e9ba43f7b9e examples/tcp-large-transfer-errors.cc --- a/examples/tcp-large-transfer-errors.cc Sun Mar 02 22:52:21 2008 +0100 +++ b/examples/tcp-large-transfer-errors.cc Sun Mar 02 22:52:55 2008 +0100 @@ -59,6 +59,7 @@ #include "ns3/packet-sink.h" #include "ns3/error-model.h" #include "ns3/node-list.h" +#include "ns3/config.h" #include "ns3/tcp.h" @@ -67,8 +68,8 @@ NS_LOG_COMPONENT_DEFINE ("TcpLargeTransferErrors"); void -ApplicationTraceSink (const TraceContext &context, Ptr packet, - const Address &addr) +ApplicationTraceSink (Ptr packet, + const Address &addr) { // g_log is not declared in optimized builds // should convert this to use of some other flag than the logging system @@ -238,7 +239,7 @@ PcapTrace pcaptrace ("tcp-large-transfer-errors.pcap"); pcaptrace.TraceAllIp (); - NodeList::Connect ("/nodes/*/applications/*/rx", MakeCallback (&ApplicationTraceSink)); + Config::Connect ("/NodeList/*/ApplicationList/*/Rx", MakeCallback (&ApplicationTraceSink)); Simulator::StopAt (Seconds(10000)); Simulator::Run (); diff -r aadaad12287c -r 4e9ba43f7b9e examples/tcp-large-transfer.cc --- a/examples/tcp-large-transfer.cc Sun Mar 02 22:52:21 2008 +0100 +++ b/examples/tcp-large-transfer.cc Sun Mar 02 22:52:55 2008 +0100 @@ -59,6 +59,7 @@ #include "ns3/packet-sink.h" #include "ns3/error-model.h" #include "ns3/node-list.h" +#include "ns3/config.h" #include "ns3/tcp.h" @@ -67,8 +68,8 @@ NS_LOG_COMPONENT_DEFINE ("TcpLargeTransfer"); void -ApplicationTraceSink (const TraceContext &context, Ptr packet, - const Address &addr) +ApplicationTraceSink (Ptr packet, + const Address &addr) { // g_log is not declared in optimized builds // should convert this to use of some other flag than the logging system @@ -223,7 +224,8 @@ PcapTrace pcaptrace ("tcp-large-transfer.pcap"); pcaptrace.TraceAllIp (); - NodeList::Connect ("/nodes/*/applications/*/rx", MakeCallback (&ApplicationTraceSink)); + Config::Connect ("/NodeList/*/ApplicationList/*/Rx", + MakeCallback (&ApplicationTraceSink)); Simulator::StopAt (Seconds(1000)); Simulator::Run (); diff -r aadaad12287c -r 4e9ba43f7b9e examples/tcp-small-transfer-oneloss.cc --- a/examples/tcp-small-transfer-oneloss.cc Sun Mar 02 22:52:21 2008 +0100 +++ b/examples/tcp-small-transfer-oneloss.cc Sun Mar 02 22:52:55 2008 +0100 @@ -59,6 +59,7 @@ #include "ns3/packet-sink.h" #include "ns3/error-model.h" #include "ns3/node-list.h" +#include "ns3/config.h" #include "ns3/tcp.h" @@ -67,8 +68,8 @@ NS_LOG_COMPONENT_DEFINE ("TcpSmallTransferOneloss"); void -ApplicationTraceSink (const TraceContext &context, Ptr packet, - const Address &addr) +ApplicationTraceSink (Ptr packet, + const Address &addr) { // g_log is not declared in optimized builds // should convert this to use of some other flag than the logging system @@ -220,7 +221,7 @@ PcapTrace pcaptrace ("tcp-small-transfer-oneloss.pcap"); pcaptrace.TraceAllIp (); - NodeList::Connect ("/nodes/*/applications/*/rx", MakeCallback (&ApplicationTraceSink)); + Config::Connect ("/NodeList/*/ApplicationList/*/Rx", MakeCallback (&ApplicationTraceSink)); Simulator::StopAt (Seconds(1000)); Simulator::Run (); diff -r aadaad12287c -r 4e9ba43f7b9e examples/tcp-small-transfer.cc --- a/examples/tcp-small-transfer.cc Sun Mar 02 22:52:21 2008 +0100 +++ b/examples/tcp-small-transfer.cc Sun Mar 02 22:52:55 2008 +0100 @@ -59,6 +59,7 @@ #include "ns3/packet-sink.h" #include "ns3/error-model.h" #include "ns3/node-list.h" +#include "ns3/config.h" #include "ns3/tcp.h" @@ -67,8 +68,8 @@ NS_LOG_COMPONENT_DEFINE ("TcpSmallTransfer"); void -ApplicationTraceSink (const TraceContext &context, Ptr packet, - const Address &addr) +ApplicationTraceSink (Ptr packet, + const Address &addr) { // g_log is not declared in optimized builds // should convert this to use of some other flag than the logging system @@ -215,7 +216,7 @@ PcapTrace pcaptrace ("tcp-small-transfer.pcap"); pcaptrace.TraceAllIp (); - NodeList::Connect ("/nodes/*/applications/*/rx", MakeCallback (&ApplicationTraceSink)); + Config::Connect ("/NodeList/*/ApplicationList/*/Rx", MakeCallback (&ApplicationTraceSink)); Simulator::StopAt (Seconds(1000)); Simulator::Run (); diff -r aadaad12287c -r 4e9ba43f7b9e samples/main-random-topology.cc --- a/samples/main-random-topology.cc Sun Mar 02 22:52:21 2008 +0100 +++ b/samples/main-random-topology.cc Sun Mar 02 22:52:55 2008 +0100 @@ -12,11 +12,12 @@ #include "ns3/mobility-helper.h" #include "ns3/node-list.h" #include "ns3/string.h" +#include "ns3/config.h" using namespace ns3; static void -CourseChange (const TraceContext &context, Ptr position) +CourseChange (std::string context, Ptr position) { Vector pos = position->GetPosition (); std::cout << Simulator::Now () << ", pos=" << position << ", x=" << pos.x << ", y=" << pos.y @@ -44,9 +45,9 @@ mobility.SetMobilityModel ("StaticMobilityModel"); mobility.Layout (objects.begin (), objects.end ()); - NodeList::Connect ("/nodes/*/$MobilityModelNotifier/course-change", - MakeCallback (&CourseChange)); - + Config::ConnectWithContext ("/NodeList/*/$MobilityModelNotifier/CourseChange", + MakeCallback (&CourseChange)); + Simulator::StopAt (Seconds (100.0)); Simulator::Run (); diff -r aadaad12287c -r 4e9ba43f7b9e samples/main-random-walk.cc --- a/samples/main-random-walk.cc Sun Mar 02 22:52:21 2008 +0100 +++ b/samples/main-random-walk.cc Sun Mar 02 22:52:55 2008 +0100 @@ -13,6 +13,7 @@ #include "ns3/node-list.h" #include "ns3/mobility-helper.h" #include "ns3/string.h" +#include "ns3/config.h" using namespace ns3; @@ -28,12 +29,10 @@ int main (int argc, char *argv[]) { - DefaultValue::Bind ("RandomWalk2dMode", "Time"); - DefaultValue::Bind ("RandomWalk2dTime", "2s"); - DefaultValue::Bind ("RandomWalk2dSpeed", "Constant:1.0"); - DefaultValue::Bind ("RandomWalk2dBounds", "0:200:0:100"); - - DefaultValue::Bind ("RandomTopologyMobilityType", "RandomWalk2dMobilityModel"); + Config::SetDefault ("RandomWalk2dMobilityModel::Mode", String ("Time")); + Config::SetDefault ("RandomWalk2dMobilityModel::Time", String ("2s")); + Config::SetDefault ("RandomWalk2dMobilityModel::Speed", String ("Constant:1.0")); + Config::SetDefault ("RandomWalk2dMobilityModel::Bounds", String ("0:200:0:100")); CommandLine::Parse (argc, argv); @@ -54,8 +53,8 @@ "Speed", String ("Constant:1.0"), "Bounds", String ("0:200:0:100")); mobility.Layout (NodeList::Begin (), NodeList::End ()); - NodeList::Connect ("/nodes/*/$MobilityModelNotifier/course-change", - MakeCallback (&CourseChange)); + Config::ConnectWithContext ("/NodeList/*/$MobilityModelNotifier/CourseChange", + MakeCallback (&CourseChange)); Simulator::StopAt (Seconds (100.0)); diff -r aadaad12287c -r 4e9ba43f7b9e utils/print-introspected-doxygen.cc --- a/utils/print-introspected-doxygen.cc Sun Mar 02 22:52:21 2008 +0100 +++ b/utils/print-introspected-doxygen.cc Sun Mar 02 22:52:55 2008 +0100 @@ -132,7 +132,7 @@ csma->AddQueue (CreateObject ()); TraceResolver::SourceCollection collection; - NodeList::GetTraceResolver ()->CollectSources ("", TraceContext (), &collection); + //NodeList::GetTraceResolver ()->CollectSources ("", TraceContext (), &collection); PrintDoxygenText (&collection, std::cout);