examples/simple-error-model.cc
changeset 2965 4b28e9740e3b
parent 2927 73b47ce1d805
child 2997 caf9d364c6fc
--- a/examples/simple-error-model.cc	Mon Apr 14 16:19:17 2008 -0700
+++ b/examples/simple-error-model.cc	Thu Apr 17 13:42:25 2008 -0700
@@ -65,11 +65,11 @@
   RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
 
   // Set a few parameters
-  Config::SetDefault ("ns3::RateErrorModel::ErrorRate", Double (0.01));
-  Config::SetDefault ("ns3::RateErrorModel::ErrorUnit", String ("EU_PKT"));
+  Config::SetDefault ("ns3::RateErrorModel::ErrorRate", DoubleValue (0.01));
+  Config::SetDefault ("ns3::RateErrorModel::ErrorUnit", StringValue ("EU_PKT"));
   
-  Config::SetDefault ("ns3::OnOffApplication::PacketSize", Uinteger (210));
-  Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRate ("448kb/s"));
+  Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
+  Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRateValue (DataRate ("448kb/s")));
 
 
   // Allow the user to override any of the defaults and the above
@@ -92,14 +92,14 @@
   // We create the channels first without any IP addressing information
   NS_LOG_INFO ("Create channels.");
   PointToPointHelper p2p;
-  p2p.SetChannelParameter ("BitRate", DataRate (5000000));
-  p2p.SetChannelParameter ("Delay", MilliSeconds (2));
+  p2p.SetChannelParameter ("BitRate", DataRateValue (DataRate (5000000)));
+  p2p.SetChannelParameter ("Delay", TimeValue (MilliSeconds (2)));
   NetDeviceContainer d0d2 = p2p.Install (n0n2);
 
   NetDeviceContainer d1d2 = p2p.Install (n1n2);
 
-  p2p.SetChannelParameter ("BitRate", DataRate (1500000));
-  p2p.SetChannelParameter ("Delay", MilliSeconds (10));
+  p2p.SetChannelParameter ("BitRate", DataRateValue (DataRate (1500000)));
+  p2p.SetChannelParameter ("Delay", TimeValue (MilliSeconds (10)));
   NetDeviceContainer d3d2 = p2p.Install (n3n2);
   
   // Later, we add IP addresses.  
@@ -124,8 +124,8 @@
 
   OnOffHelper onoff ("ns3::Udp",
     Address (InetSocketAddress (i3i2.GetAddress (1), port)));
-  onoff.SetAttribute ("OnTime", ConstantVariable(1));
-  onoff.SetAttribute ("OffTime", ConstantVariable(0));
+  onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable(1)));
+  onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable(0)));
 
   ApplicationContainer apps = onoff.Install (c.Get (0));
   apps.Start(Seconds(1.0));
@@ -140,14 +140,14 @@
 
   // Create a similar flow from n3 to n1, starting at time 1.1 seconds
   onoff.SetAttribute ("Remote", 
-    Address (InetSocketAddress (i1i2.GetAddress (0), port)));
+                      AddressValue (InetSocketAddress (i1i2.GetAddress (0), port)));
   apps = onoff.Install (c.Get (3));
   apps.Start(Seconds(1.1));
   apps.Stop (Seconds(10.0));
 
   // Create a packet sink to receive these packets
   sink.SetAttribute ("Local", 
-    Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
+                     AddressValue (InetSocketAddress (Ipv4Address::GetAny (), port)));
   apps = sink.Install (c.Get (1));
   apps.Start (Seconds (1.1));
   apps.Stop (Seconds (10.0));
@@ -157,9 +157,9 @@
   //
   // Create an ErrorModel based on the implementation (constructor)
   // specified by the default classId
-  Ptr<RateErrorModel> em = CreateObject<RateErrorModel> ("RanVar", UniformVariable (0.0, 1.0),
-                                                         "ErrorRate", Double (0.001));
-  d3d2.Get (0)->SetAttribute ("ReceiveErrorModel", Pointer (em));
+  Ptr<RateErrorModel> em = CreateObject<RateErrorModel> ("RanVar", RandomVariableValue (UniformVariable (0.0, 1.0)),
+                                                         "ErrorRate", DoubleValue (0.001));
+  d3d2.Get (0)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
 
   // Now, let's use the ListErrorModel and explicitly force a loss
   // of the packets with pkt-uids = 11 and 17 on node 2, device 0
@@ -169,7 +169,7 @@
   // This time, we'll explicitly create the error model we want
   Ptr<ListErrorModel> pem = CreateObject<ListErrorModel> ();
   pem->SetList (sampleList);
-  d0d2.Get (1)->SetAttribute ("ReceiveErrorModel", Pointer (pem));
+  d0d2.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (pem));
 
   std::ofstream ascii;
   ascii.open ("simple-error-model.tr");