From ea76a9f88ee7634105318b26ccb33145b2267dc3 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Fri, 28 Sep 2007 19:04:11 +0100 Subject: [PATCH] Create real nodes, not just mobility models. --- samples/main-random-walk.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/samples/main-random-walk.cc b/samples/main-random-walk.cc index e1c308359..b1b542c17 100644 --- a/samples/main-random-walk.cc +++ b/samples/main-random-walk.cc @@ -10,6 +10,8 @@ #include "ns3/command-line.h" #include "ns3/simulator.h" #include "ns3/nstime.h" +#include "ns3/node.h" +#include "ns3/node-list.h" using namespace ns3; @@ -39,15 +41,15 @@ int main (int argc, char *argv[]) RandomTopology topology; - std::vector > objects; for (uint32_t i = 0; i < 100; i++) { - Ptr notifier = Create (); - notifier->TraceConnect ("/course-change", MakeCallback (&CourseChange)); - objects.push_back (notifier); + Ptr node = Create (); + node->AddInterface (Create ()); } - topology.Layout (objects.begin (), objects.end ()); + topology.Layout (NodeList::Begin (), NodeList::End ()); + NodeList::Connect ("/nodes/*/$MobilityModelNotifier/course-change", + MakeCallback (&CourseChange)); Simulator::StopAt (Seconds (100.0));