get rid of Attribute class. Use AttributeValue subclasses directly.
1.1 --- a/examples/csma-broadcast.cc Mon Apr 14 16:19:17 2008 -0700
1.2 +++ b/examples/csma-broadcast.cc Thu Apr 17 13:42:25 2008 -0700
1.3 @@ -68,8 +68,8 @@
1.4
1.5 NS_LOG_INFO ("Build Topology.");
1.6 CsmaHelper csma;
1.7 - csma.SetChannelParameter ("BitRate", DataRate(5000000));
1.8 - csma.SetChannelParameter ("Delay", MilliSeconds(2));
1.9 + csma.SetChannelParameter ("BitRate", DataRateValue (DataRate(5000000)));
1.10 + csma.SetChannelParameter ("Delay", TimeValue (MilliSeconds(2)));
1.11
1.12 NetDeviceContainer n0 = csma.Install (c0);
1.13 NetDeviceContainer n1 = csma.Install (c1);
1.14 @@ -97,8 +97,8 @@
1.15 NS_LOG_INFO ("Create Applications.");
1.16 OnOffHelper onoff ("ns3::Udp",
1.17 Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port)));
1.18 - onoff.SetAttribute ("OnTime", ConstantVariable (1));
1.19 - onoff.SetAttribute ("OffTime", ConstantVariable (0));
1.20 + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
1.21 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
1.22
1.23 ApplicationContainer app = onoff.Install (c0.Get (0));
1.24 // Start the application
2.1 --- a/examples/csma-multicast.cc Mon Apr 14 16:19:17 2008 -0700
2.2 +++ b/examples/csma-multicast.cc Thu Apr 17 13:42:25 2008 -0700
2.3 @@ -59,7 +59,7 @@
2.4 // Set up default values for the simulation.
2.5 //
2.6 // Select Ethernet II-style encapsulation (no LLC/Snap header)
2.7 - Config::SetDefault ("ns3::CsmaNetDevice::EncapsulationMode", String ("IpArp"));
2.8 + Config::SetDefault ("ns3::CsmaNetDevice::EncapsulationMode", StringValue ("IpArp"));
2.9
2.10 // Allow the user to override any of the defaults at
2.11 // run-time, via command-line arguments
2.12 @@ -75,8 +75,8 @@
2.13
2.14 NS_LOG_INFO ("Build Topology.");
2.15 CsmaHelper csma;
2.16 - csma.SetChannelParameter ("BitRate", DataRate (5000000));
2.17 - csma.SetChannelParameter ("Delay", MilliSeconds (2));
2.18 + csma.SetChannelParameter ("BitRate", DataRateValue (DataRate (5000000)));
2.19 + csma.SetChannelParameter ("Delay", TimeValue (MilliSeconds (2)));
2.20
2.21 // We will use these NetDevice containers later, for IP addressing
2.22 NetDeviceContainer nd0 = csma.Install (c0); // First LAN
2.23 @@ -143,10 +143,10 @@
2.24 // every few seconds
2.25 OnOffHelper onoff ("ns3::Udp",
2.26 Address (InetSocketAddress (multicastGroup, multicastPort)));
2.27 - onoff.SetAttribute ("OnTime", ConstantVariable (1));
2.28 - onoff.SetAttribute ("OffTime", ConstantVariable (0));
2.29 - onoff.SetAttribute ("DataRate", DataRate ("255b/s"));
2.30 - onoff.SetAttribute ("PacketSize", Uinteger (128));
2.31 + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
2.32 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
2.33 + onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("255b/s")));
2.34 + onoff.SetAttribute ("PacketSize", UintegerValue (128));
2.35
2.36 ApplicationContainer srcC = onoff.Install (c0.Get (0));
2.37
2.38 @@ -158,7 +158,7 @@
2.39
2.40 // Create an optional packet sink to receive these packets
2.41 PacketSinkHelper sink ("ns3::Udp",
2.42 - Address (InetSocketAddress (Ipv4Address::GetAny(), multicastPort)));
2.43 + InetSocketAddress (Ipv4Address::GetAny(), multicastPort));
2.44
2.45 ApplicationContainer sinkC = sink.Install (c1.Get (2)); // Node n4
2.46 // Start the sink
3.1 --- a/examples/csma-one-subnet.cc Mon Apr 14 16:19:17 2008 -0700
3.2 +++ b/examples/csma-one-subnet.cc Thu Apr 17 13:42:25 2008 -0700
3.3 @@ -66,8 +66,8 @@
3.4
3.5 NS_LOG_INFO ("Build Topology");
3.6 CsmaHelper csma;
3.7 - csma.SetChannelParameter ("BitRate", DataRate (5000000));
3.8 - csma.SetChannelParameter ("Delay", MilliSeconds (2));
3.9 + csma.SetChannelParameter ("BitRate", DataRateValue (5000000));
3.10 + csma.SetChannelParameter ("Delay", TimeValue (MilliSeconds (2)));
3.11 //
3.12 // Now fill out the topology by creating the net devices required to connect
3.13 // the nodes to the channels and hooking them up. AddIpv4CsmaNetDevice will
3.14 @@ -97,8 +97,8 @@
3.15
3.16 OnOffHelper onoff ("ns3::Udp",
3.17 Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port)));
3.18 - onoff.SetAttribute ("OnTime", ConstantVariable (1));
3.19 - onoff.SetAttribute ("OffTime", ConstantVariable (0));
3.20 + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
3.21 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
3.22
3.23 ApplicationContainer app = onoff.Install (c.Get (0));
3.24 // Start the application
3.25 @@ -114,7 +114,7 @@
3.26 // Create a similar flow from n3 to n0, starting at time 1.1 seconds
3.27 //
3.28 onoff.SetAttribute ("Remote",
3.29 - Address (InetSocketAddress (Ipv4Address ("10.1.1.1"), port)));
3.30 + AddressValue (InetSocketAddress (Ipv4Address ("10.1.1.1"), port)));
3.31 ApplicationContainer app2 = onoff.Install (c.Get (3));
3.32
3.33 sink.Install (c.Get (0));
4.1 --- a/examples/csma-packet-socket.cc Mon Apr 14 16:19:17 2008 -0700
4.2 +++ b/examples/csma-packet-socket.cc Thu Apr 17 13:42:25 2008 -0700
4.3 @@ -70,13 +70,13 @@
4.4
4.5 // create the shared medium used by all csma devices.
4.6 NS_LOG_INFO ("Create channels.");
4.7 - Ptr<CsmaChannel> channel = CreateObject<CsmaChannel> ("BitRate", DataRate(5000000),
4.8 - "Delay", MilliSeconds(2));
4.9 + Ptr<CsmaChannel> channel = CreateObject<CsmaChannel> ("BitRate", DataRateValue (DataRate(5000000)),
4.10 + "Delay", TimeValue (MilliSeconds(2)));
4.11
4.12 // use a helper function to connect our nodes to the shared channel.
4.13 NS_LOG_INFO ("Build Topology.");
4.14 CsmaHelper csma;
4.15 - csma.SetDeviceParameter ("EncapsulationMode", String ("Llc"));
4.16 + csma.SetDeviceParameter ("EncapsulationMode", StringValue ("Llc"));
4.17 NetDeviceContainer devs = csma.Install (c, channel);
4.18
4.19 NS_LOG_INFO ("Create Applications.");
4.20 @@ -86,8 +86,8 @@
4.21 socket.SetPhysicalAddress (devs.Get (1)->GetAddress ());
4.22 socket.SetProtocol (2);
4.23 OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
4.24 - onoff.SetAttribute ("OnTime", ConstantVariable (1.0));
4.25 - onoff.SetAttribute ("OffTime", ConstantVariable (0.0));
4.26 + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1.0)));
4.27 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0.0)));
4.28
4.29 ApplicationContainer apps = onoff.Install (c.Get (0));
4.30 apps.Start (Seconds (1.0));
4.31 @@ -96,8 +96,8 @@
4.32 socket.SetSingleDevice (devs.Get (3)->GetIfIndex ());
4.33 socket.SetPhysicalAddress (devs.Get (0)->GetAddress ());
4.34 socket.SetProtocol (3);
4.35 - onoff.SetAttribute ("Remote", Address (socket));
4.36 - onoff.SetAttribute ("OffTime", ConstantVariable (0.0));
4.37 + onoff.SetAttribute ("Remote", AddressValue (socket));
4.38 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0.0)));
4.39 apps = onoff.Install (c.Get (3));
4.40 apps.Start (Seconds (1.0));
4.41 apps.Stop (Seconds (10.0));
5.1 --- a/examples/mixed-global-routing.cc Mon Apr 14 16:19:17 2008 -0700
5.2 +++ b/examples/mixed-global-routing.cc Thu Apr 17 13:42:25 2008 -0700
5.3 @@ -51,8 +51,8 @@
5.4 int
5.5 main (int argc, char *argv[])
5.6 {
5.7 - Config::SetDefault ("ns3::OnOffApplication::PacketSize", Uinteger (210));
5.8 - Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRate ("448kb/s"));
5.9 + Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
5.10 + Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("448kb/s"));
5.11
5.12 // Allow the user to override any of the defaults and the above
5.13 // Bind ()s at run-time, via command-line arguments
5.14 @@ -73,20 +73,20 @@
5.15 // We create the channels first without any IP addressing information
5.16 NS_LOG_INFO ("Create channels.");
5.17 PointToPointHelper p2p;
5.18 - p2p.SetChannelParameter ("BitRate", DataRate (5000000));
5.19 - p2p.SetChannelParameter ("Delay", MilliSeconds (2));
5.20 + p2p.SetChannelParameter ("BitRate", StringValue ("5Mbps"));
5.21 + p2p.SetChannelParameter ("Delay", StringValue ("2ms"));
5.22 NetDeviceContainer d0d2 = p2p.Install (n0n2);
5.23
5.24 NetDeviceContainer d1d2 = p2p.Install (n1n2);
5.25
5.26 - p2p.SetChannelParameter ("BitRate", DataRate (1500000));
5.27 - p2p.SetChannelParameter ("Delay", MilliSeconds (10));
5.28 + p2p.SetChannelParameter ("BitRate", StringValue ("1500Kbps"));
5.29 + p2p.SetChannelParameter ("Delay", StringValue ("10ms"));
5.30 NetDeviceContainer d5d6 = p2p.Install (n5n6);
5.31
5.32 // We create the channels first without any IP addressing information
5.33 CsmaHelper csma;
5.34 - csma.SetChannelParameter ("BitRate", DataRate (5000000));
5.35 - csma.SetChannelParameter ("Delay", MilliSeconds (2));
5.36 + csma.SetChannelParameter ("BitRate", StringValue ("5Mbps"));
5.37 + csma.SetChannelParameter ("Delay", StringValue ("2ms"));
5.38 NetDeviceContainer d2345 = csma.Install (n2345);
5.39
5.40 // Later, we add IP addresses.
5.41 @@ -113,11 +113,11 @@
5.42 NS_LOG_INFO ("Create Applications.");
5.43 uint16_t port = 9; // Discard port (RFC 863)
5.44 OnOffHelper onoff ("ns3::Udp",
5.45 - Address (InetSocketAddress (i5i6.GetAddress (1), port)));
5.46 - onoff.SetAttribute ("OnTime", ConstantVariable (1));
5.47 - onoff.SetAttribute ("OffTime", ConstantVariable (0));
5.48 - onoff.SetAttribute ("DataRate", DataRate("300bps"));
5.49 - onoff.SetAttribute ("PacketSize", Uinteger (50));
5.50 + InetSocketAddress (i5i6.GetAddress (1), port));
5.51 + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
5.52 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
5.53 + onoff.SetAttribute ("DataRate", StringValue ("300bps"));
5.54 + onoff.SetAttribute ("PacketSize", UintegerValue (50));
5.55
5.56 ApplicationContainer apps = onoff.Install (c.Get (0));
5.57 apps.Start (Seconds (1.0));
6.1 --- a/examples/mixed-wireless.cc Mon Apr 14 16:19:17 2008 -0700
6.2 +++ b/examples/mixed-wireless.cc Thu Apr 17 13:42:25 2008 -0700
6.3 @@ -96,8 +96,8 @@
6.4 // Simulation defaults are typically set next, before command line
6.5 // arguments are parsed.
6.6 //
6.7 - Config::SetDefault ("ns3::OnOffApplication::PacketSize", String ("210"));
6.8 - Config::SetDefault ("ns3::OnOffApplication::DataRate", String ("448kb/s"));
6.9 + Config::SetDefault ("ns3::OnOffApplication::PacketSize", StringValue ("210"));
6.10 + Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("448kb/s"));
6.11
6.12 //
6.13 // For convenience, we add the local variables to the command line argument
6.14 @@ -163,9 +163,9 @@
6.15 positionAlloc->Add (Vector (5.0, 0.0, 0.0));
6.16 mobility.SetPositionAllocator (positionAlloc);
6.17 mobility.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
6.18 - "Bounds", Rectangle (0, 1000, 0, 1000),
6.19 - "Speed", ConstantVariable (2000),
6.20 - "Pause", ConstantVariable (0.2));
6.21 + "Bounds", RectangleValue (Rectangle (0, 1000, 0, 1000)),
6.22 + "Speed", RandomVariableValue (ConstantVariable (2000)),
6.23 + "Pause", RandomVariableValue (ConstantVariable (0.2)));
6.24 mobility.Layout (backbone);
6.25
6.26 ///////////////////////////////////////////////////////////////////////////
6.27 @@ -194,8 +194,8 @@
6.28 // collection.
6.29 //
6.30 CsmaHelper csma;
6.31 - csma.SetChannelParameter ("BitRate", DataRate (5000000));
6.32 - csma.SetChannelParameter ("Delay", MilliSeconds (2));
6.33 + csma.SetChannelParameter ("BitRate", DataRateValue (DataRate (5000000)));
6.34 + csma.SetChannelParameter ("Delay", TimeValue (MilliSeconds (2)));
6.35 NetDeviceContainer lanDevices = csma.Install (lan);
6.36 //
6.37 // Add the IPv4 protocol stack to the nodes in our container
6.38 @@ -269,9 +269,9 @@
6.39 mobility.PushReferenceMobilityModel (backbone.Get (i));
6.40 mobility.SetPositionAllocator (subnetAlloc);
6.41 mobility.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
6.42 - "Bounds", Rectangle (-25, 25, -25, 25),
6.43 - "Speed", ConstantVariable (30),
6.44 - "Pause", ConstantVariable (0.4));
6.45 + "Bounds", RectangleValue (Rectangle (-25, 25, -25, 25)),
6.46 + "Speed", RandomVariableValue (ConstantVariable (30)),
6.47 + "Pause", RandomVariableValue (ConstantVariable (0.4)));
6.48 mobility.Layout (infra);
6.49 }
6.50 ///////////////////////////////////////////////////////////////////////////
6.51 @@ -304,8 +304,8 @@
6.52
6.53 OnOffHelper onoff ("ns3::Udp",
6.54 Address (InetSocketAddress (remoteAddr, port)));
6.55 - onoff.SetAttribute ("OnTime", ConstantVariable (1));
6.56 - onoff.SetAttribute ("OffTime", ConstantVariable (0));
6.57 + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
6.58 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
6.59 ApplicationContainer apps = onoff.Install (appSource);
6.60 apps.Start (Seconds (3.0));
6.61 apps.Stop (Seconds (20.0));
7.1 --- a/examples/simple-alternate-routing.cc Mon Apr 14 16:19:17 2008 -0700
7.2 +++ b/examples/simple-alternate-routing.cc Thu Apr 17 13:42:25 2008 -0700
7.3 @@ -62,8 +62,8 @@
7.4 //
7.5 RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
7.6
7.7 - Config::SetDefault ("ns3::OnOffApplication::PacketSize", Uinteger (210));
7.8 - Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRate ("300b/s"));
7.9 + Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
7.10 + Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("300b/s"));
7.11
7.12 // The below metric, if set to 3 or higher, will cause packets between
7.13 // n1 and n3 to take the 2-hop route through n2
7.14 @@ -97,17 +97,17 @@
7.15 // We create the channels first without any IP addressing information
7.16 NS_LOG_INFO ("Create channels.");
7.17 PointToPointHelper p2p;
7.18 - p2p.SetChannelParameter ("BitRate", DataRate (5000000));
7.19 - p2p.SetChannelParameter ("Delay", MilliSeconds (2));
7.20 + p2p.SetChannelParameter ("BitRate", StringValue ("5Mbps"));
7.21 + p2p.SetChannelParameter ("Delay", StringValue ("2ms"));
7.22 NetDeviceContainer d0d2 = p2p.Install (n0n2);
7.23
7.24 NetDeviceContainer d1d2 = p2p.Install (n1n2);
7.25
7.26 - p2p.SetChannelParameter ("BitRate", DataRate(1500000));
7.27 - p2p.SetChannelParameter ("Delay", MilliSeconds (10));
7.28 + p2p.SetChannelParameter ("BitRate", StringValue ("1500kbps"));
7.29 + p2p.SetChannelParameter ("Delay", StringValue ("10ms"));
7.30 NetDeviceContainer d3d2 = p2p.Install (n3n2);
7.31
7.32 - p2p.SetChannelParameter ("Delay", MilliSeconds (100));
7.33 + p2p.SetChannelParameter ("Delay", StringValue ("100ms"));
7.34 NetDeviceContainer d1d3 = p2p.Install (n1n3);
7.35
7.36 InternetStackHelper internet;
7.37 @@ -143,8 +143,8 @@
7.38 // Create a flow from n3 to n1, starting at time 1.1 seconds
7.39 OnOffHelper onoff ("ns3::Udp",
7.40 Address (InetSocketAddress (i1i2.GetAddress (0), port)));
7.41 - onoff.SetAttribute ("OnTime", ConstantVariable (1));
7.42 - onoff.SetAttribute ("OffTime", ConstantVariable (0));
7.43 + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
7.44 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
7.45
7.46 ApplicationContainer apps = onoff.Install (c.Get (3));
7.47 apps.Start (Seconds (1.1));
8.1 --- a/examples/simple-error-model.cc Mon Apr 14 16:19:17 2008 -0700
8.2 +++ b/examples/simple-error-model.cc Thu Apr 17 13:42:25 2008 -0700
8.3 @@ -65,11 +65,11 @@
8.4 RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
8.5
8.6 // Set a few parameters
8.7 - Config::SetDefault ("ns3::RateErrorModel::ErrorRate", Double (0.01));
8.8 - Config::SetDefault ("ns3::RateErrorModel::ErrorUnit", String ("EU_PKT"));
8.9 + Config::SetDefault ("ns3::RateErrorModel::ErrorRate", DoubleValue (0.01));
8.10 + Config::SetDefault ("ns3::RateErrorModel::ErrorUnit", StringValue ("EU_PKT"));
8.11
8.12 - Config::SetDefault ("ns3::OnOffApplication::PacketSize", Uinteger (210));
8.13 - Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRate ("448kb/s"));
8.14 + Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
8.15 + Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRateValue (DataRate ("448kb/s")));
8.16
8.17
8.18 // Allow the user to override any of the defaults and the above
8.19 @@ -92,14 +92,14 @@
8.20 // We create the channels first without any IP addressing information
8.21 NS_LOG_INFO ("Create channels.");
8.22 PointToPointHelper p2p;
8.23 - p2p.SetChannelParameter ("BitRate", DataRate (5000000));
8.24 - p2p.SetChannelParameter ("Delay", MilliSeconds (2));
8.25 + p2p.SetChannelParameter ("BitRate", DataRateValue (DataRate (5000000)));
8.26 + p2p.SetChannelParameter ("Delay", TimeValue (MilliSeconds (2)));
8.27 NetDeviceContainer d0d2 = p2p.Install (n0n2);
8.28
8.29 NetDeviceContainer d1d2 = p2p.Install (n1n2);
8.30
8.31 - p2p.SetChannelParameter ("BitRate", DataRate (1500000));
8.32 - p2p.SetChannelParameter ("Delay", MilliSeconds (10));
8.33 + p2p.SetChannelParameter ("BitRate", DataRateValue (DataRate (1500000)));
8.34 + p2p.SetChannelParameter ("Delay", TimeValue (MilliSeconds (10)));
8.35 NetDeviceContainer d3d2 = p2p.Install (n3n2);
8.36
8.37 // Later, we add IP addresses.
8.38 @@ -124,8 +124,8 @@
8.39
8.40 OnOffHelper onoff ("ns3::Udp",
8.41 Address (InetSocketAddress (i3i2.GetAddress (1), port)));
8.42 - onoff.SetAttribute ("OnTime", ConstantVariable(1));
8.43 - onoff.SetAttribute ("OffTime", ConstantVariable(0));
8.44 + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable(1)));
8.45 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable(0)));
8.46
8.47 ApplicationContainer apps = onoff.Install (c.Get (0));
8.48 apps.Start(Seconds(1.0));
8.49 @@ -140,14 +140,14 @@
8.50
8.51 // Create a similar flow from n3 to n1, starting at time 1.1 seconds
8.52 onoff.SetAttribute ("Remote",
8.53 - Address (InetSocketAddress (i1i2.GetAddress (0), port)));
8.54 + AddressValue (InetSocketAddress (i1i2.GetAddress (0), port)));
8.55 apps = onoff.Install (c.Get (3));
8.56 apps.Start(Seconds(1.1));
8.57 apps.Stop (Seconds(10.0));
8.58
8.59 // Create a packet sink to receive these packets
8.60 sink.SetAttribute ("Local",
8.61 - Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
8.62 + AddressValue (InetSocketAddress (Ipv4Address::GetAny (), port)));
8.63 apps = sink.Install (c.Get (1));
8.64 apps.Start (Seconds (1.1));
8.65 apps.Stop (Seconds (10.0));
8.66 @@ -157,9 +157,9 @@
8.67 //
8.68 // Create an ErrorModel based on the implementation (constructor)
8.69 // specified by the default classId
8.70 - Ptr<RateErrorModel> em = CreateObject<RateErrorModel> ("RanVar", UniformVariable (0.0, 1.0),
8.71 - "ErrorRate", Double (0.001));
8.72 - d3d2.Get (0)->SetAttribute ("ReceiveErrorModel", Pointer (em));
8.73 + Ptr<RateErrorModel> em = CreateObject<RateErrorModel> ("RanVar", RandomVariableValue (UniformVariable (0.0, 1.0)),
8.74 + "ErrorRate", DoubleValue (0.001));
8.75 + d3d2.Get (0)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
8.76
8.77 // Now, let's use the ListErrorModel and explicitly force a loss
8.78 // of the packets with pkt-uids = 11 and 17 on node 2, device 0
8.79 @@ -169,7 +169,7 @@
8.80 // This time, we'll explicitly create the error model we want
8.81 Ptr<ListErrorModel> pem = CreateObject<ListErrorModel> ();
8.82 pem->SetList (sampleList);
8.83 - d0d2.Get (1)->SetAttribute ("ReceiveErrorModel", Pointer (pem));
8.84 + d0d2.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (pem));
8.85
8.86 std::ofstream ascii;
8.87 ascii.open ("simple-error-model.tr");
9.1 --- a/examples/simple-global-routing.cc Mon Apr 14 16:19:17 2008 -0700
9.2 +++ b/examples/simple-global-routing.cc Thu Apr 17 13:42:25 2008 -0700
9.3 @@ -67,8 +67,8 @@
9.4 RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
9.5
9.6 // Set up some default values for the simulation. Use the
9.7 - Config::SetDefault ("ns3::OnOffApplication::PacketSize", Uinteger (210));
9.8 - Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRate ("448kb/s"));
9.9 + Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
9.10 + Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("448kb/s"));
9.11
9.12 //DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30);
9.13
9.14 @@ -92,14 +92,14 @@
9.15 // We create the channels first without any IP addressing information
9.16 NS_LOG_INFO ("Create channels.");
9.17 PointToPointHelper p2p;
9.18 - p2p.SetChannelParameter ("BitRate", DataRate (5000000));
9.19 - p2p.SetChannelParameter ("Delay", MilliSeconds (2));
9.20 + p2p.SetChannelParameter ("BitRate", StringValue ("5Mbps"));
9.21 + p2p.SetChannelParameter ("Delay", StringValue ("2ms"));
9.22 NetDeviceContainer d0d2 = p2p.Install (n0n2);
9.23
9.24 NetDeviceContainer d1d2 = p2p.Install (n1n2);
9.25
9.26 - p2p.SetChannelParameter ("BitRate", DataRate (1500000));
9.27 - p2p.SetChannelParameter ("Delay", MilliSeconds (10));
9.28 + p2p.SetChannelParameter ("BitRate", StringValue ("1500kbps"));
9.29 + p2p.SetChannelParameter ("Delay", StringValue ("10ms"));
9.30 NetDeviceContainer d3d2 = p2p.Install (n3n2);
9.31
9.32 // Later, we add IP addresses.
9.33 @@ -124,8 +124,8 @@
9.34 uint16_t port = 9; // Discard port (RFC 863)
9.35 OnOffHelper onoff ("ns3::Udp",
9.36 Address (InetSocketAddress (i3i2.GetAddress (0), port)));
9.37 - onoff.SetAttribute ("OnTime", ConstantVariable (1));
9.38 - onoff.SetAttribute ("OffTime", ConstantVariable (0));
9.39 + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
9.40 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
9.41 ApplicationContainer apps = onoff.Install (c.Get (0));
9.42 apps.Start (Seconds (1.0));
9.43 apps.Stop (Seconds (10.0));
9.44 @@ -139,7 +139,7 @@
9.45
9.46 // Create a similar flow from n3 to n1, starting at time 1.1 seconds
9.47 onoff.SetAttribute ("Remote",
9.48 - Address (InetSocketAddress (i1i2.GetAddress (0), port)));
9.49 + AddressValue (InetSocketAddress (i1i2.GetAddress (0), port)));
9.50 apps = onoff.Install (c.Get (3));
9.51 apps.Start (Seconds (1.1));
9.52 apps.Stop (Seconds (10.0));
10.1 --- a/examples/simple-point-to-point-olsr.cc Mon Apr 14 16:19:17 2008 -0700
10.2 +++ b/examples/simple-point-to-point-olsr.cc Thu Apr 17 13:42:25 2008 -0700
10.3 @@ -67,8 +67,8 @@
10.4
10.5 // Set up some default values for the simulation. Use the
10.6
10.7 - Config::SetDefault ("ns3::OnOffApplication::PacketSize", Uinteger (210));
10.8 - Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRate ("448kb/s"));
10.9 + Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
10.10 + Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("448kb/s"));
10.11
10.12 //DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30);
10.13
10.14 @@ -93,12 +93,12 @@
10.15 // We create the channels first without any IP addressing information
10.16 NS_LOG_INFO ("Create channels.");
10.17 PointToPointHelper p2p;
10.18 - p2p.SetChannelParameter ("BitRate", DataRate (5000000));
10.19 - p2p.SetChannelParameter ("Delay", MilliSeconds (2));
10.20 + p2p.SetChannelParameter ("BitRate", StringValue ("5Mbps"));
10.21 + p2p.SetChannelParameter ("Delay", StringValue ("2ms"));
10.22 NetDeviceContainer nd02 = p2p.Install (n02);
10.23 NetDeviceContainer nd12 = p2p.Install (n12);
10.24 - p2p.SetChannelParameter ("BitRate", DataRate (1500000));
10.25 - p2p.SetChannelParameter ("Delay", MilliSeconds (10));
10.26 + p2p.SetChannelParameter ("BitRate", StringValue ("1500Kbps"));
10.27 + p2p.SetChannelParameter ("Delay", StringValue ("10ms"));
10.28 NetDeviceContainer nd32 = p2p.Install (n32);
10.29 NetDeviceContainer nd34 = p2p.Install (n34);
10.30
10.31 @@ -128,9 +128,9 @@
10.32 uint16_t port = 9; // Discard port (RFC 863)
10.33
10.34 OnOffHelper onoff ("ns3::Udp",
10.35 - Address (InetSocketAddress (i34.GetAddress (1), port)));
10.36 - onoff.SetAttribute ("OnTime", ConstantVariable (1));
10.37 - onoff.SetAttribute ("OffTime", ConstantVariable (0));
10.38 + InetSocketAddress (i34.GetAddress (1), port));
10.39 + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
10.40 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
10.41
10.42 ApplicationContainer apps = onoff.Install (c.Get (0));
10.43 apps.Start (Seconds (1.0));
10.44 @@ -138,7 +138,7 @@
10.45
10.46 // Create a packet sink to receive these packets
10.47 PacketSinkHelper sink ("ns3::Udp",
10.48 - Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
10.49 + InetSocketAddress (Ipv4Address::GetAny (), port));
10.50
10.51 apps = sink.Install (c.Get (3));
10.52 apps.Start (Seconds (1.0));
10.53 @@ -146,7 +146,7 @@
10.54
10.55 // Create a similar flow from n3 to n1, starting at time 1.1 seconds
10.56 onoff.SetAttribute ("Remote",
10.57 - Address (InetSocketAddress (i12.GetAddress (0), port)));
10.58 + AddressValue (InetSocketAddress (i12.GetAddress (0), port)));
10.59 apps = onoff.Install (c.Get (3));
10.60 apps.Start (Seconds (1.1));
10.61 apps.Stop (Seconds (10.0));
11.1 --- a/examples/tcp-large-transfer.cc Mon Apr 14 16:19:17 2008 -0700
11.2 +++ b/examples/tcp-large-transfer.cc Thu Apr 17 13:42:25 2008 -0700
11.3 @@ -137,8 +137,8 @@
11.4
11.5 // We create the channels first without any IP addressing information
11.6 PointToPointHelper p2p;
11.7 - p2p.SetChannelParameter ("BitRate", DataRate(10000000));
11.8 - p2p.SetChannelParameter ("Delay", MilliSeconds(10));
11.9 + p2p.SetChannelParameter ("BitRate", DataRateValue (DataRate(10000000)));
11.10 + p2p.SetChannelParameter ("Delay", TimeValue (MilliSeconds(10)));
11.11 NetDeviceContainer dev0 = p2p.Install (c0);
11.12 NetDeviceContainer dev1 = p2p.Install (c1);
11.13
11.14 @@ -170,7 +170,7 @@
11.15
11.16 // Create a packet sink to receive these packets
11.17 PacketSinkHelper sink ("ns3::Tcp",
11.18 - Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)));
11.19 + InetSocketAddress (Ipv4Address::GetAny (), servPort));
11.20
11.21 ApplicationContainer apps = sink.Install (c1.Get (1));
11.22 apps.Start (Seconds (0.0));
12.1 --- a/examples/udp-echo.cc Mon Apr 14 16:19:17 2008 -0700
12.2 +++ b/examples/udp-echo.cc Thu Apr 17 13:42:25 2008 -0700
12.3 @@ -87,8 +87,8 @@
12.4 // Explicitly create the channels required by the topology (shown above).
12.5 //
12.6 CsmaHelper csma;
12.7 - csma.SetChannelParameter ("BitRate", DataRate(5000000));
12.8 - csma.SetChannelParameter ("Delay", MilliSeconds (2));
12.9 + csma.SetChannelParameter ("BitRate", DataRateValue (DataRate(5000000)));
12.10 + csma.SetChannelParameter ("Delay", TimeValue (MilliSeconds (2)));
12.11 NetDeviceContainer d = csma.Install (n);
12.12
12.13 Ipv4AddressHelper ipv4;
12.14 @@ -119,9 +119,9 @@
12.15 Time interPacketInterval = Seconds (1.);
12.16 UdpEchoClientHelper client;
12.17 client.SetRemote (i.GetAddress (1), port);
12.18 - client.SetAppAttribute ("MaxPackets", Uinteger (maxPacketCount));
12.19 - client.SetAppAttribute ("Interval", interPacketInterval);
12.20 - client.SetAppAttribute ("PacketSize", Uinteger (packetSize));
12.21 + client.SetAppAttribute ("MaxPackets", UintegerValue (maxPacketCount));
12.22 + client.SetAppAttribute ("Interval", TimeValue (interPacketInterval));
12.23 + client.SetAppAttribute ("PacketSize", UintegerValue (packetSize));
12.24 apps = client.Install (n.Get (0));
12.25 apps.Start (Seconds (2.0));
12.26 apps.Stop (Seconds (10.0));
13.1 --- a/examples/wifi-adhoc.cc Mon Apr 14 16:19:17 2008 -0700
13.2 +++ b/examples/wifi-adhoc.cc Thu Apr 17 13:42:25 2008 -0700
13.3 @@ -134,10 +134,10 @@
13.4 socket.SetProtocol (1);
13.5
13.6 OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
13.7 - onoff.SetAttribute ("OnTime", ConstantVariable (250));
13.8 - onoff.SetAttribute ("OffTime", ConstantVariable (0));
13.9 - onoff.SetAttribute ("DataRate", DataRate (60000000));
13.10 - onoff.SetAttribute ("PacketSize", Uinteger (2000));
13.11 + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (250)));
13.12 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
13.13 + onoff.SetAttribute ("DataRate", DataRateValue (DataRate (60000000)));
13.14 + onoff.SetAttribute ("PacketSize", UintegerValue (2000));
13.15
13.16 ApplicationContainer apps = onoff.Install (c.Get (0));
13.17 apps.Start (Seconds (0.5));
13.18 @@ -156,8 +156,8 @@
13.19 int main (int argc, char *argv[])
13.20 {
13.21 // disable fragmentation
13.22 - Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", String ("2200"));
13.23 - Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", String ("2200"));
13.24 + Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
13.25 + Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200"));
13.26
13.27 CommandLine cmd;
13.28 cmd.Parse (argc, argv);
13.29 @@ -174,56 +174,56 @@
13.30 NS_LOG_DEBUG ("54");
13.31 experiment = Experiment ("54mb");
13.32 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
13.33 - "DataMode", String ("wifia-54mbs"));
13.34 + "DataMode", StringValue ("wifia-54mbs"));
13.35 dataset = experiment.Run (wifi);
13.36 gnuplot.AddDataset (dataset);
13.37
13.38 NS_LOG_DEBUG ("48");
13.39 experiment = Experiment ("48mb");
13.40 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
13.41 - "DataMode", String ("wifia-48mbs"));
13.42 + "DataMode", StringValue ("wifia-48mbs"));
13.43 dataset = experiment.Run (wifi);
13.44 gnuplot.AddDataset (dataset);
13.45
13.46 NS_LOG_DEBUG ("36");
13.47 experiment = Experiment ("36mb");
13.48 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
13.49 - "DataMode", String ("wifia-36mbs"));
13.50 + "DataMode", StringValue ("wifia-36mbs"));
13.51 dataset = experiment.Run (wifi);
13.52 gnuplot.AddDataset (dataset);
13.53
13.54 NS_LOG_DEBUG ("24");
13.55 experiment = Experiment ("24mb");
13.56 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
13.57 - "DataMode", String ("wifia-24mbs"));
13.58 + "DataMode", StringValue ("wifia-24mbs"));
13.59 dataset = experiment.Run (wifi);
13.60 gnuplot.AddDataset (dataset);
13.61
13.62 NS_LOG_DEBUG ("18");
13.63 experiment = Experiment ("18mb");
13.64 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
13.65 - "DataMode", String ("wifia-18mbs"));
13.66 + "DataMode", StringValue ("wifia-18mbs"));
13.67 dataset = experiment.Run (wifi);
13.68 gnuplot.AddDataset (dataset);
13.69
13.70 NS_LOG_DEBUG ("12");
13.71 experiment = Experiment ("12mb");
13.72 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
13.73 - "DataMode", String ("wifia-12mbs"));
13.74 + "DataMode", StringValue ("wifia-12mbs"));
13.75 dataset = experiment.Run (wifi);
13.76 gnuplot.AddDataset (dataset);
13.77
13.78 NS_LOG_DEBUG ("9");
13.79 experiment = Experiment ("9mb");
13.80 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
13.81 - "DataMode", String ("wifia-9mbs"));
13.82 + "DataMode", StringValue ("wifia-9mbs"));
13.83 dataset = experiment.Run (wifi);
13.84 gnuplot.AddDataset (dataset);
13.85
13.86 NS_LOG_DEBUG ("6");
13.87 experiment = Experiment ("6mb");
13.88 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
13.89 - "DataMode", String ("wifia-6mbs"));
13.90 + "DataMode", StringValue ("wifia-6mbs"));
13.91 dataset = experiment.Run (wifi);
13.92 gnuplot.AddDataset (dataset);
13.93
13.94 @@ -231,7 +231,7 @@
13.95
13.96
13.97 gnuplot = Gnuplot ("rate-control.png");
13.98 - Config::SetDefault ("ns3::WifiPhy::Standard", String ("holland"));
13.99 + Config::SetDefault ("ns3::WifiPhy::Standard", StringValue ("holland"));
13.100
13.101
13.102 NS_LOG_DEBUG ("arf");
14.1 --- a/examples/wifi-ap.cc Mon Apr 14 16:19:17 2008 -0700
14.2 +++ b/examples/wifi-ap.cc Thu Apr 17 13:42:25 2008 -0700
14.3 @@ -113,9 +113,9 @@
14.4 Packet::EnableMetadata ();
14.5
14.6 // enable rts cts all the time.
14.7 - Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", String ("0"));
14.8 + Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("0"));
14.9 // disable fragmentation
14.10 - Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", String ("2200"));
14.11 + Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
14.12
14.13 WifiHelper wifi;
14.14 MobilityHelper mobility;
14.15 @@ -141,13 +141,14 @@
14.16 wifi.SetPhy ("ns3::WifiPhy");
14.17 wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
14.18 // setup stas.
14.19 - wifi.SetMac ("ns3::NqstaWifiMac", "Ssid", ssid,
14.20 - "ActiveProbing", Boolean (false));
14.21 + wifi.SetMac ("ns3::NqstaWifiMac",
14.22 + "Ssid", SsidValue (ssid),
14.23 + "ActiveProbing", BooleanValue (false));
14.24 staDevs = wifi.Install (stas, channel);
14.25 // setup ap.
14.26 - wifi.SetMac ("ns3::NqapWifiMac", "Ssid", ssid,
14.27 - "BeaconGeneration", Boolean (true),
14.28 - "BeaconInterval", Seconds (2.5));
14.29 + wifi.SetMac ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid),
14.30 + "BeaconGeneration", BooleanValue (true),
14.31 + "BeaconInterval", TimeValue (Seconds (2.5)));
14.32 wifi.Install (ap, channel);
14.33
14.34 // mobility.
14.35 @@ -162,8 +163,8 @@
14.36 socket.SetProtocol (1);
14.37
14.38 OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
14.39 - onoff.SetAttribute ("OnTime", ConstantVariable (42));
14.40 - onoff.SetAttribute ("OffTime", ConstantVariable (0));
14.41 + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (42)));
14.42 + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
14.43
14.44 ApplicationContainer apps = onoff.Install (stas.Get (0));
14.45 apps.Start (Seconds (0.5));
15.1 --- a/samples/main-attribute-value.cc Mon Apr 14 16:19:17 2008 -0700
15.2 +++ b/samples/main-attribute-value.cc Thu Apr 17 13:42:25 2008 -0700
15.3 @@ -51,10 +51,10 @@
15.4 // (this default can be observed in the function DropTailQueue::GetTypeId)
15.5 //
15.6 // Here, we set it to 80 packets. We could use one of two value types:
15.7 - // a string-based value or a Uinteger value
15.8 - Config::SetDefault ("ns3::DropTailQueue::MaxPackets", String ("80"));
15.9 + // a string-based value or a UintegerValue value
15.10 + Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("80"));
15.11 // The below function call is redundant
15.12 - Config::SetDefault ("ns3::DropTailQueue::MaxPackets", Uinteger(80));
15.13 + Config::SetDefault ("ns3::DropTailQueue::MaxPackets", UintegerValue (80));
15.14
15.15 // Allow the user to override any of the defaults and the above
15.16 // SetDefaults() at run-time, via command-line arguments
15.17 @@ -88,7 +88,9 @@
15.18 // First, we observe that we can get a pointer to the (base class)
15.19 // queue via the PointToPointNetDevice attributes, where it is called
15.20 // TxQueue
15.21 - Ptr<Queue> txQueue = Pointer (net0->GetAttribute ("TxQueue"));
15.22 + PointerValue ptr;
15.23 + net0->GetAttribute ("TxQueue", ptr);
15.24 + Ptr<Queue> txQueue = ptr.Get<Queue> ();
15.25
15.26 // Using the GetObject function, we can perform a safe downcast
15.27 // to a DropTailQueue, where MaxPackets is a member
15.28 @@ -101,18 +103,19 @@
15.29 // the attribute system stores values and not disparate types.
15.30 // Here, the attribute value is assigned to a Uinteger, and
15.31 // the Get() method on this value produces the (unwrapped) uint32_t.
15.32 - Uinteger limit = dtq->GetAttribute ("MaxPackets");
15.33 + UintegerValue limit;
15.34 + dtq->GetAttribute ("MaxPackets", limit);
15.35 NS_LOG_INFO ("1. dtq limit: " << limit.Get () << " packets");
15.36
15.37 // Note that the above downcast is not really needed; we could have
15.38 // done the same using the Ptr<Queue> even though the attribute
15.39 // is a member of the subclass
15.40 - limit = txQueue->GetAttribute ("MaxPackets");
15.41 + txQueue->GetAttribute ("MaxPackets", limit);
15.42 NS_LOG_INFO ("2. txQueue limit: " << limit.Get () << " packets");
15.43
15.44 // Now, let's set it to another value (60 packets)
15.45 - txQueue->SetAttribute("MaxPackets", Uinteger (60));
15.46 - limit = txQueue->GetAttribute ("MaxPackets");
15.47 + txQueue->SetAttribute("MaxPackets", UintegerValue (60));
15.48 + txQueue->GetAttribute ("MaxPackets", limit);
15.49 NS_LOG_INFO ("3. txQueue limit changed: " << limit.Get () << " packets");
15.50
15.51 // 2. Namespace-based access
15.52 @@ -122,18 +125,18 @@
15.53 // namespace; this approach is useful if one doesn't have access to
15.54 // the underlying pointers and would like to configure a specific
15.55 // attribute with a single statement.
15.56 - Config::Set ("/NodeList/0/DeviceList/0/TxQueue/MaxPackets", Uinteger (25));
15.57 - limit = txQueue->GetAttribute ("MaxPackets");
15.58 + Config::Set ("/NodeList/0/DeviceList/0/TxQueue/MaxPackets", UintegerValue (25));
15.59 + txQueue->GetAttribute ("MaxPackets", limit);
15.60 NS_LOG_INFO ("4. txQueue limit changed through namespace: " <<
15.61 - limit.Get () << " packets");
15.62 + limit.Get () << " packets");
15.63
15.64 // we could have also used wildcards to set this value for all nodes
15.65 // and all net devices (which in this simple example has the same
15.66 // effect as the previous Set())
15.67 - Config::Set ("/NodeList/*/DeviceList/*/TxQueue/MaxPackets", Uinteger (15));
15.68 - limit = txQueue->GetAttribute ("MaxPackets");
15.69 + Config::Set ("/NodeList/*/DeviceList/*/TxQueue/MaxPackets", UintegerValue (15));
15.70 + txQueue->GetAttribute ("MaxPackets", limit);
15.71 NS_LOG_INFO ("5. txQueue limit changed through wildcarded namespace: " <<
15.72 - limit.Get () << " packets");
15.73 + limit.Get () << " packets");
15.74
15.75 Simulator::Destroy ();
15.76 }
16.1 --- a/samples/main-grid-topology.cc Mon Apr 14 16:19:17 2008 -0700
16.2 +++ b/samples/main-grid-topology.cc Thu Apr 17 13:42:25 2008 -0700
16.3 @@ -23,12 +23,12 @@
16.4 // the x interval between each object is 5 meters
16.5 // and the y interval between each object is 20 meters
16.6 mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
16.7 - "MinX", Double (-100.0),
16.8 - "MinY", Double (-100.0),
16.9 - "DeltaX", Double (5.0),
16.10 - "DeltaY", Double (20.0),
16.11 - "GridWidth", Uinteger (20),
16.12 - "LayoutType", String ("RowFirst"));
16.13 + "MinX", DoubleValue (-100.0),
16.14 + "MinY", DoubleValue (-100.0),
16.15 + "DeltaX", DoubleValue (5.0),
16.16 + "DeltaY", DoubleValue (20.0),
16.17 + "GridWidth", UintegerValue (20),
16.18 + "LayoutType", StringValue ("RowFirst"));
16.19 // each object will be attached a static position.
16.20 // i.e., once set by the "position allocator", the
16.21 // position will never change.
17.1 --- a/samples/main-propagation-loss.cc Mon Apr 14 16:19:17 2008 -0700
17.2 +++ b/samples/main-propagation-loss.cc Thu Apr 17 13:42:25 2008 -0700
17.3 @@ -51,8 +51,8 @@
17.4 int main (int argc, char *argv[])
17.5 {
17.6
17.7 - Config::SetGlobal ("LogDistancePropagationLossModel::ReferenceDistance", String ("1.0"));
17.8 - Config::SetGlobal ("LogDistancePropagationLossModel::Exponent", String ("4"));
17.9 + Config::SetGlobal ("LogDistancePropagationLossModel::ReferenceDistance", StringValue ("1.0"));
17.10 + Config::SetGlobal ("LogDistancePropagationLossModel::Exponent", StringValue ("4"));
17.11
17.12 PrintOne (-10, 20, 5, 0, 10000, 2);
17.13
18.1 --- a/samples/main-random-topology.cc Mon Apr 14 16:19:17 2008 -0700
18.2 +++ b/samples/main-random-topology.cc Thu Apr 17 13:42:25 2008 -0700
18.3 @@ -27,9 +27,9 @@
18.4 MobilityHelper mobility;
18.5 mobility.EnableNotifier ();
18.6 mobility.SetPositionAllocator ("ns3::RandomDiscPositionAllocator",
18.7 - "X", String ("100.0"),
18.8 - "Y", String ("100.0"),
18.9 - "Rho", String ("Uniform:0:30"));
18.10 + "X", StringValue ("100.0"),
18.11 + "Y", StringValue ("100.0"),
18.12 + "Rho", StringValue ("Uniform:0:30"));
18.13 mobility.SetMobilityModel ("ns3::StaticMobilityModel");
18.14 mobility.Layout (c);
18.15
19.1 --- a/samples/main-random-walk.cc Mon Apr 14 16:19:17 2008 -0700
19.2 +++ b/samples/main-random-walk.cc Thu Apr 17 13:42:25 2008 -0700
19.3 @@ -19,10 +19,10 @@
19.4
19.5 int main (int argc, char *argv[])
19.6 {
19.7 - Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Mode", String ("Time"));
19.8 - Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Time", String ("2s"));
19.9 - Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Speed", String ("Constant:1.0"));
19.10 - Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Bounds", String ("0:200:0:100"));
19.11 + Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Mode", StringValue ("Time"));
19.12 + Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Time", StringValue ("2s"));
19.13 + Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Speed", StringValue ("Constant:1.0"));
19.14 + Config::SetDefault ("ns3::RandomWalk2dMobilityModel::Bounds", StringValue ("0:200:0:100"));
19.15
19.16 CommandLine cmd;
19.17 cmd.Parse (argc, argv);
19.18 @@ -33,17 +33,17 @@
19.19 MobilityHelper mobility;
19.20 mobility.EnableNotifier ();
19.21 mobility.SetPositionAllocator ("ns3::RandomDiscPositionAllocator",
19.22 - "X", String ("100.0"),
19.23 - "Y", String ("100.0"),
19.24 - "Rho", String ("Uniform:0:30"));
19.25 + "X", StringValue ("100.0"),
19.26 + "Y", StringValue ("100.0"),
19.27 + "Rho", StringValue ("Uniform:0:30"));
19.28 mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
19.29 - "Mode", String ("Time"),
19.30 - "Time", String ("2s"),
19.31 - "Speed", String ("Constant:1.0"),
19.32 - "Bounds", String ("0:200:0:100"));
19.33 + "Mode", StringValue ("Time"),
19.34 + "Time", StringValue ("2s"),
19.35 + "Speed", StringValue ("Constant:1.0"),
19.36 + "Bounds", StringValue ("0:200:0:100"));
19.37 mobility.LayoutAll ();
19.38 Config::Connect ("/NodeList/*/$ns3::MobilityModelNotifier/CourseChange",
19.39 - MakeCallback (&CourseChange));
19.40 + MakeCallback (&CourseChange));
19.41
19.42 Simulator::StopAt (Seconds (100.0));
19.43
20.1 --- a/src/applications/onoff/onoff-application.cc Mon Apr 14 16:19:17 2008 -0700
20.2 +++ b/src/applications/onoff/onoff-application.cc Thu Apr 17 13:42:25 2008 -0700
20.3 @@ -52,34 +52,34 @@
20.4 .SetParent<Application> ()
20.5 .AddConstructor<OnOffApplication> ()
20.6 .AddAttribute ("DataRate", "The data rate in on state.",
20.7 - DataRate ("500kb/s"),
20.8 + DataRateValue (DataRate ("500kb/s")),
20.9 MakeDataRateAccessor (&OnOffApplication::m_cbrRate),
20.10 MakeDataRateChecker ())
20.11 .AddAttribute ("PacketSize", "The size of packets sent in on state",
20.12 - Uinteger (512),
20.13 + UintegerValue (512),
20.14 MakeUintegerAccessor (&OnOffApplication::m_pktSize),
20.15 MakeUintegerChecker<uint32_t> (1))
20.16 .AddAttribute ("Remote", "The address of the destination",
20.17 - Address (),
20.18 + AddressValue (),
20.19 MakeAddressAccessor (&OnOffApplication::m_peer),
20.20 MakeAddressChecker ())
20.21 .AddAttribute ("OnTime", "A RandomVariable used to pick the duration of the 'On' state.",
20.22 - ConstantVariable (1.0),
20.23 + RandomVariableValue (ConstantVariable (1.0)),
20.24 MakeRandomVariableAccessor (&OnOffApplication::m_onTime),
20.25 MakeRandomVariableChecker ())
20.26 .AddAttribute ("OffTime", "A RandomVariable used to pick the duration of the 'Off' state.",
20.27 - ConstantVariable (1.0),
20.28 + RandomVariableValue (ConstantVariable (1.0)),
20.29 MakeRandomVariableAccessor (&OnOffApplication::m_offTime),
20.30 MakeRandomVariableChecker ())
20.31 .AddAttribute ("MaxBytes",
20.32 "The total number of bytes to send. Once these bytes are sent, "
20.33 "no packet is sent again, even in on state. The value zero means "
20.34 "that there is no limit.",
20.35 - Uinteger (0),
20.36 + UintegerValue (0),
20.37 MakeUintegerAccessor (&OnOffApplication::m_maxBytes),
20.38 MakeUintegerChecker<uint32_t> ())
20.39 .AddAttribute ("Protocol", "The type of protocol to use.",
20.40 - Udp::GetTypeId (),
20.41 + TypeIdValue (Udp::GetTypeId ()),
20.42 MakeTypeIdAccessor (&OnOffApplication::m_tid),
20.43 MakeTypeIdChecker ())
20.44 .AddTraceSource ("Tx", "A new packet is created and is sent",
21.1 --- a/src/applications/packet-sink/packet-sink.cc Mon Apr 14 16:19:17 2008 -0700
21.2 +++ b/src/applications/packet-sink/packet-sink.cc Thu Apr 17 13:42:25 2008 -0700
21.3 @@ -43,11 +43,11 @@
21.4 .SetParent<Application> ()
21.5 .AddConstructor<PacketSink> ()
21.6 .AddAttribute ("Local", "The Address on which to Bind the rx socket.",
21.7 - Address (),
21.8 + AddressValue (),
21.9 MakeAddressAccessor (&PacketSink::m_local),
21.10 MakeAddressChecker ())
21.11 .AddAttribute ("Protocol", "The type id of the protocol to use for the rx socket.",
21.12 - Udp::GetTypeId (),
21.13 + TypeIdValue (Udp::GetTypeId ()),
21.14 MakeTypeIdAccessor (&PacketSink::m_tid),
21.15 MakeTypeIdChecker ())
21.16 .AddTraceSource ("Rx", "A packet has been received",
22.1 --- a/src/applications/udp-echo/udp-echo-client.cc Mon Apr 14 16:19:17 2008 -0700
22.2 +++ b/src/applications/udp-echo/udp-echo-client.cc Thu Apr 17 13:42:25 2008 -0700
22.3 @@ -38,23 +38,23 @@
22.4 .SetParent<Application> ()
22.5 .AddConstructor<UdpEchoClient> ()
22.6 .AddAttribute ("MaxPackets", "XXX",
22.7 - Uinteger (100),
22.8 + UintegerValue (100),
22.9 MakeUintegerAccessor (&UdpEchoClient::m_count),
22.10 MakeUintegerChecker<uint32_t> ())
22.11 .AddAttribute ("Interval", "XXX",
22.12 - Seconds (1.0),
22.13 + TimeValue (Seconds (1.0)),
22.14 MakeTimeAccessor (&UdpEchoClient::m_interval),
22.15 MakeTimeChecker ())
22.16 .AddAttribute ("RemoteIpv4", "XXX",
22.17 - Ipv4Address (),
22.18 + Ipv4AddressValue (),
22.19 MakeIpv4AddressAccessor (&UdpEchoClient::m_peerAddress),
22.20 MakeIpv4AddressChecker ())
22.21 .AddAttribute ("RemotePort", "XXX",
22.22 - Uinteger (0),
22.23 + UintegerValue (0),
22.24 MakeUintegerAccessor (&UdpEchoClient::m_peerPort),
22.25 MakeUintegerChecker<uint16_t> ())
22.26 .AddAttribute ("PacketSize", "Size of packets generated",
22.27 - Uinteger (100),
22.28 + UintegerValue (100),
22.29 MakeUintegerAccessor (&UdpEchoClient::m_size),
22.30 MakeUintegerChecker<uint32_t> ())
22.31 ;
23.1 --- a/src/applications/udp-echo/udp-echo-server.cc Mon Apr 14 16:19:17 2008 -0700
23.2 +++ b/src/applications/udp-echo/udp-echo-server.cc Thu Apr 17 13:42:25 2008 -0700
23.3 @@ -40,7 +40,7 @@
23.4 .SetParent<Application> ()
23.5 .AddConstructor<UdpEchoServer> ()
23.6 .AddAttribute ("Port", "Port on which we listen for incoming packets.",
23.7 - Uinteger (9),
23.8 + UintegerValue (9),
23.9 MakeUintegerAccessor (&UdpEchoServer::m_port),
23.10 MakeUintegerChecker<uint16_t> ())
23.11 ;
24.1 --- a/src/common/error-model.cc Mon Apr 14 16:19:17 2008 -0700
24.2 +++ b/src/common/error-model.cc Thu Apr 17 13:42:25 2008 -0700
24.3 @@ -42,7 +42,7 @@
24.4 static TypeId tid = TypeId ("ns3::ErrorModel")
24.5 .SetParent<Object> ()
24.6 .AddAttribute ("IsEnabled", "Whether this ErrorModel is enabled or not.",
24.7 - Boolean (true),
24.8 + BooleanValue (true),
24.9 MakeBooleanAccessor (&ErrorModel::m_enable),
24.10 MakeBooleanChecker ())
24.11 ;
24.12 @@ -111,17 +111,17 @@
24.13 .SetParent<ErrorModel> ()
24.14 .AddConstructor<RateErrorModel> ()
24.15 .AddAttribute ("ErrorUnit", "The error unit",
24.16 - Enum (EU_BYTE),
24.17 + EnumValue (EU_BYTE),
24.18 MakeEnumAccessor (&RateErrorModel::m_unit),
24.19 MakeEnumChecker (EU_BYTE, "EU_BYTE",
24.20 EU_PKT, "EU_PKT",
24.21 EU_BIT, "EU_BIT"))
24.22 .AddAttribute ("ErrorRate", "The error rate.",
24.23 - Double (0.0),
24.24 + DoubleValue (0.0),
24.25 MakeDoubleAccessor (&RateErrorModel::m_rate),
24.26 MakeDoubleChecker<double> ())
24.27 .AddAttribute ("RanVar", "The decision variable attached to this error model.",
24.28 - UniformVariable (0.0, 1.0),
24.29 + RandomVariableValue (UniformVariable (0.0, 1.0)),
24.30 MakeRandomVariableAccessor (&RateErrorModel::m_ranvar),
24.31 MakeRandomVariableChecker ())
24.32 ;
25.1 --- a/src/contrib/config-store.cc Mon Apr 14 16:19:17 2008 -0700
25.2 +++ b/src/contrib/config-store.cc Thu Apr 17 13:42:25 2008 -0700
25.3 @@ -22,12 +22,12 @@
25.4 .SetParent<ObjectBase> ()
25.5 .AddAttribute ("LoadFilename",
25.6 "The file where the configuration should be loaded from.",
25.7 - String (""),
25.8 + StringValue (""),
25.9 MakeStringAccessor (&ConfigStore::m_loadFilename),
25.10 MakeStringChecker ())
25.11 .AddAttribute ("StoreFilename",
25.12 "The file where the configuration should be stored to.",
25.13 - String (""),
25.14 + StringValue (""),
25.15 MakeStringAccessor (&ConfigStore::m_storeFilename),
25.16 MakeStringChecker ())
25.17 ;
25.18 @@ -55,7 +55,7 @@
25.19 {
25.20 is >> path >> value;
25.21 NS_LOG_DEBUG (path << "=" << value);
25.22 - Config::Set (path, String (value));
25.23 + Config::Set (path, StringValue (value));
25.24 }
25.25 }
25.26 void
25.27 @@ -116,7 +116,9 @@
25.28 if (ptrChecker != 0)
25.29 {
25.30 NS_LOG_DEBUG ("pointer attribute " << tid.GetAttributeName (i));
25.31 - Ptr<const Object> tmp = Pointer (object->GetAttribute (tid.GetAttributeName (i)));
25.32 + PointerValue ptr;
25.33 + object->GetAttribute (tid.GetAttributeName (i), ptr);
25.34 + Ptr<const Object> tmp = ptr.Get<Object> ();
25.35 if (tmp != 0)
25.36 {
25.37 m_currentPath.push_back (tid.GetAttributeName (i));
25.38 @@ -132,7 +134,8 @@
25.39 if (vectorChecker != 0)
25.40 {
25.41 NS_LOG_DEBUG ("vector attribute " << tid.GetAttributeName (i));
25.42 - ObjectVector vector = object->GetAttribute (tid.GetAttributeName (i));
25.43 + ObjectVectorValue vector;
25.44 + object->GetAttribute (tid.GetAttributeName (i), vector);
25.45 for (uint32_t j = 0; j < vector.GetN (); ++j)
25.46 {
25.47 NS_LOG_DEBUG ("vector attribute item " << j);
25.48 @@ -152,8 +155,9 @@
25.49 if ((flags & TypeId::ATTR_GET) && accessor->HasGetter () &&
25.50 (flags & TypeId::ATTR_SET) && accessor->HasSetter ())
25.51 {
25.52 - std::string value = object->GetAttributeAsString (tid.GetAttributeName (i));
25.53 - os << GetCurrentPath (tid.GetAttributeName (i)) << " " << value << std::endl;
25.54 + StringValue str;
25.55 + object->GetAttribute (tid.GetAttributeName (i), str);
25.56 + os << GetCurrentPath (tid.GetAttributeName (i)) << " " << str.Get () << std::endl;
25.57 }
25.58 else
25.59 {
26.1 --- a/src/core/attribute-accessor-helper.h Mon Apr 14 16:19:17 2008 -0700
26.2 +++ b/src/core/attribute-accessor-helper.h Thu Apr 17 13:42:25 2008 -0700
26.3 @@ -48,8 +48,8 @@
26.4 public:
26.5 AccessorHelper () {}
26.6
26.7 - virtual bool Set (ObjectBase * object, Attribute val) const {
26.8 - const U *value = val.DynCast<const U*> ();
26.9 + virtual bool Set (ObjectBase * object, const AttributeValue & val) const {
26.10 + const U *value = dynamic_cast<const U *> (&val);
26.11 if (value == 0)
26.12 {
26.13 return false;
26.14 @@ -62,8 +62,8 @@
26.15 return DoSet (obj, value);
26.16 }
26.17
26.18 - virtual bool Get (const ObjectBase * object, Attribute val) const {
26.19 - U *value = val.DynCast<U*> ();
26.20 + virtual bool Get (const ObjectBase * object, AttributeValue &val) const {
26.21 + U *value = dynamic_cast<U *> (&val);
26.22 if (value == 0)
26.23 {
26.24 return false;
26.25 @@ -76,7 +76,6 @@
26.26 return DoGet (obj, value);
26.27 }
26.28
26.29 -
26.30 private:
26.31 virtual bool DoSet (T *object, const U *v) const = 0;
26.32 virtual bool DoGet (const T *object, U *v) const = 0;
27.1 --- a/src/core/attribute-helper.h Mon Apr 14 16:19:17 2008 -0700
27.2 +++ b/src/core/attribute-helper.h Thu Apr 17 13:42:25 2008 -0700
27.3 @@ -33,8 +33,8 @@
27.4 {
27.5 struct SimpleAttributeChecker : public BASE
27.6 {
27.7 - virtual bool Check (Attribute value) const {
27.8 - return value.DynCast<const T *> () != 0;
27.9 + virtual bool Check (const AttributeValue &value) const {
27.10 + return dynamic_cast<const T *> (&value) != 0;
27.11 }
27.12 virtual std::string GetType (void) const {
27.13 return m_type;
27.14 @@ -45,8 +45,18 @@
27.15 virtual std::string GetTypeConstraints (void) const {
27.16 return "";
27.17 }
27.18 - virtual Attribute Create (void) const {
27.19 - return Attribute (ns3::Create<T> ());
27.20 + virtual Ptr<AttributeValue> Create (void) const {
27.21 + return ns3::Create<T> ();
27.22 + }
27.23 + virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const {
27.24 + const T *src = dynamic_cast<const T *> (&source);
27.25 + T *dst = dynamic_cast<T *> (&destination);
27.26 + if (src == 0 || dst == 0)
27.27 + {
27.28 + return false;
27.29 + }
27.30 + *dst = *src;
27.31 + return true;
27.32 }
27.33 std::string m_type;
27.34 } *checker = new SimpleAttributeChecker ();
27.35 @@ -98,6 +108,22 @@
27.36 return MakeAccessorHelper<type##Value> (a1, a2); \
27.37 }
27.38
27.39 +#define ATTRIBUTE_VALUE_DEFINE_WITH_NAME(type,name) \
27.40 + class name##Value : public AttributeValue \
27.41 + { \
27.42 + public: \
27.43 + name##Value (); \
27.44 + name##Value (const type &value); \
27.45 + void Set (const type &value); \
27.46 + type Get (void) const; \
27.47 + virtual Ptr<AttributeValue> Copy (void) const; \
27.48 + virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const; \
27.49 + virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker); \
27.50 + private: \
27.51 + type m_value; \
27.52 + };
27.53 +
27.54 +
27.55 /**
27.56 * \ingroup AttributeHelper
27.57 * \param type the name of the class.
27.58 @@ -106,21 +132,8 @@
27.59 * This macro is typically invoked in a class header.
27.60 */
27.61 #define ATTRIBUTE_VALUE_DEFINE(type) \
27.62 - class type##Value : public AttributeValue \
27.63 - { \
27.64 - public: \
27.65 - type##Value (); \
27.66 - type##Value (const type &value); \
27.67 - void Set (const type &value); \
27.68 - type Get (void) const; \
27.69 - virtual Attribute Copy (void) const; \
27.70 - virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const; \
27.71 - virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker); \
27.72 - type##Value (Attribute value); \
27.73 - operator Attribute () const; \
27.74 - private: \
27.75 - type m_value; \
27.76 - };
27.77 + ATTRIBUTE_VALUE_DEFINE_WITH_NAME (type,type)
27.78 +
27.79
27.80 /**
27.81 * \ingroup AttributeHelper
27.82 @@ -130,9 +143,7 @@
27.83 * from instances of type Attribute.
27.84 * Typically invoked from xxx.h.
27.85 */
27.86 -#define ATTRIBUTE_CONVERTER_DEFINE(type) \
27.87 - type (Attribute value); \
27.88 - operator Attribute () const;
27.89 +#define ATTRIBUTE_CONVERTER_DEFINE(type)
27.90
27.91 /**
27.92 * \ingroup AttributeHelper
27.93 @@ -146,42 +157,34 @@
27.94 class type##Checker : public AttributeChecker {}; \
27.95 Ptr<const AttributeChecker> Make##type##Checker (void); \
27.96
27.97 -/**
27.98 - * \ingroup AttributeHelper
27.99 - * \param type the name of the class
27.100 - *
27.101 - * This macro implements the XXXValue class (without the
27.102 - * XXXValue::SerializeToString and XXXValue::DeserializeFromString
27.103 - * methods).
27.104 - * Typically invoked from xxx.cc.
27.105 - */
27.106 -#define ATTRIBUTE_VALUE_IMPLEMENT_NO_SERIALIZE(type) \
27.107 - type##Value::type##Value () \
27.108 +
27.109 +#define ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME(type,name) \
27.110 + name##Value::name##Value () \
27.111 : m_value () {} \
27.112 - type##Value::type##Value (const type &value) \
27.113 + name##Value::name##Value (const type &value) \
27.114 : m_value (value) {} \
27.115 - void type##Value::Set (const type &v) { \
27.116 + void name##Value::Set (const type &v) { \
27.117 m_value = v; \
27.118 } \
27.119 - type type##Value::Get (void) const { \
27.120 + type name##Value::Get (void) const { \
27.121 return m_value; \
27.122 } \
27.123 - Attribute \
27.124 - type##Value::Copy (void) const { \
27.125 - return Attribute (ns3::Create<type##Value> (*this)); \
27.126 + Ptr<AttributeValue> \
27.127 + name##Value::Copy (void) const { \
27.128 + return ns3::Create<name##Value> (*this); \
27.129 + } \
27.130 + std::string \
27.131 + name##Value::SerializeToString (Ptr<const AttributeChecker> checker) const { \
27.132 + std::ostringstream oss; \
27.133 + oss << m_value; \
27.134 + return oss.str (); \
27.135 } \
27.136 - type##Value::type##Value (Attribute value) \
27.137 - { \
27.138 - type##Value *v = value.DynCast<type##Value *> (); \
27.139 - if (v == 0) \
27.140 - { \
27.141 - NS_FATAL_ERROR ("Unexpected type of value. Expected \"" << #type << "Value\""); \
27.142 - } \
27.143 - m_value = v->Get (); \
27.144 - } \
27.145 - type##Value::operator Attribute () const \
27.146 - { \
27.147 - return Attribute (ns3::Create<type##Value> (*this)); \
27.148 + bool \
27.149 + name##Value::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker) { \
27.150 + std::istringstream iss; \
27.151 + iss.str (value); \
27.152 + iss >> m_value; \
27.153 + return !iss.bad () && !iss.fail (); \
27.154 }
27.155
27.156 /**
27.157 @@ -194,20 +197,8 @@
27.158 * Typically invoked from xxx.cc.
27.159 */
27.160 #define ATTRIBUTE_VALUE_IMPLEMENT(type) \
27.161 - std::string \
27.162 - type##Value::SerializeToString (Ptr<const AttributeChecker> checker) const { \
27.163 - std::ostringstream oss; \
27.164 - oss << m_value; \
27.165 - return oss.str (); \
27.166 - } \
27.167 - bool \
27.168 - type##Value::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker) { \
27.169 - std::istringstream iss; \
27.170 - iss.str (value); \
27.171 - iss >> m_value; \
27.172 - return !iss.bad () && !iss.fail (); \
27.173 - } \
27.174 - ATTRIBUTE_VALUE_IMPLEMENT_NO_SERIALIZE (type)
27.175 + ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME(type,type)
27.176 +
27.177
27.178 /**
27.179 * \ingroup AttributeHelper
27.180 @@ -229,20 +220,7 @@
27.181 * This macro implements the conversion operators to and from
27.182 * instances of type Attribute. Typically invoked from xxx.cc.
27.183 */
27.184 -#define ATTRIBUTE_CONVERTER_IMPLEMENT(type) \
27.185 - type::type (Attribute value) \
27.186 - { \
27.187 - const type##Value *v = value.DynCast<const type##Value *> (); \
27.188 - if (v == 0) \
27.189 - { \
27.190 - NS_FATAL_ERROR ("Unexpected type of value. Expected \"" << #type << "Value\""); \
27.191 - } \
27.192 - *this = v->Get (); \
27.193 - } \
27.194 - type::operator Attribute () const \
27.195 - { \
27.196 - return Attribute (ns3::Create<type##Value> (*this)); \
27.197 - }
27.198 +#define ATTRIBUTE_CONVERTER_IMPLEMENT(type)
27.199
27.200
27.201 /**
27.202 @@ -252,8 +230,7 @@
27.203 * This macro should be invoked from a public section of the class
27.204 * declaration.
27.205 */
27.206 -#define ATTRIBUTE_HELPER_HEADER_1(type) \
27.207 - ATTRIBUTE_CONVERTER_DEFINE (type)
27.208 +#define ATTRIBUTE_HELPER_HEADER_1(type)
27.209
27.210 /**
27.211 * \ingroup AttributeHelper
28.1 --- a/src/core/attribute-list.cc Mon Apr 14 16:19:17 2008 -0700
28.2 +++ b/src/core/attribute-list.cc Thu Apr 17 13:42:25 2008 -0700
28.3 @@ -36,7 +36,7 @@
28.4 {
28.5 struct Attr attr;
28.6 attr.checker = i->checker;
28.7 - attr.value = i->value.Copy ();
28.8 + attr.value = i->value->Copy ();
28.9 m_attributes.push_back (attr);
28.10 }
28.11 }
28.12 @@ -48,7 +48,7 @@
28.13 {
28.14 struct Attr attr;
28.15 attr.checker = i->checker;
28.16 - attr.value = i->value.Copy ();
28.17 + attr.value = i->value->Copy ();
28.18 m_attributes.push_back (attr);
28.19 }
28.20 return *this;
28.21 @@ -59,7 +59,7 @@
28.22 }
28.23
28.24 void
28.25 -AttributeList::Set (std::string name, Attribute value)
28.26 +AttributeList::Set (std::string name, const AttributeValue &value)
28.27 {
28.28 struct TypeId::AttributeInfo info;
28.29 bool ok = TypeId::LookupAttributeByFullName (name, &info);
28.30 @@ -74,7 +74,7 @@
28.31 }
28.32 }
28.33 bool
28.34 -AttributeList::SetFailSafe (std::string name, Attribute value)
28.35 +AttributeList::SetFailSafe (std::string name, const AttributeValue &value)
28.36 {
28.37 struct TypeId::AttributeInfo info;
28.38 bool ok = TypeId::LookupAttributeByFullName (name, &info);
28.39 @@ -86,7 +86,7 @@
28.40 return ok;
28.41 }
28.42 void
28.43 -AttributeList::SetWithTid (TypeId tid, std::string name, Attribute value)
28.44 +AttributeList::SetWithTid (TypeId tid, std::string name, const AttributeValue & value)
28.45 {
28.46 struct TypeId::AttributeInfo info;
28.47 bool ok = tid.LookupAttributeByName (name, &info);
28.48 @@ -102,7 +102,7 @@
28.49 }
28.50
28.51 void
28.52 -AttributeList::DoSetOne (Ptr<const AttributeChecker> checker, Attribute value)
28.53 +AttributeList::DoSetOne (Ptr<const AttributeChecker> checker, const AttributeValue &value)
28.54 {
28.55 // get rid of any previous value stored in this
28.56 // vector of values.
28.57 @@ -121,36 +121,38 @@
28.58 m_attributes.push_back (attr);
28.59 }
28.60 bool
28.61 -AttributeList::DoSet (struct TypeId::AttributeInfo *info, Attribute value)
28.62 +AttributeList::DoSet (struct TypeId::AttributeInfo *info, const AttributeValue &value)
28.63 {
28.64 if (info->checker == 0)
28.65 {
28.66 return false;
28.67 }
28.68 bool ok = info->checker->Check (value);
28.69 + if (ok)
28.70 + {
28.71 + DoSetOne (info->checker, value);
28.72 + return true;
28.73 + }
28.74 +
28.75 + // attempt to convert to string.
28.76 + const StringValue *str = dynamic_cast<const StringValue *> (&value);
28.77 + if (str == 0)
28.78 + {
28.79 + return false;
28.80 + }
28.81 + // attempt to convert back to value.
28.82 + Ptr<AttributeValue> v = info->checker->Create ();
28.83 + ok = v->DeserializeFromString (str->Get (), info->checker);
28.84 if (!ok)
28.85 {
28.86 - // attempt to convert to string.
28.87 - const StringValue *str = value.DynCast<const StringValue *> ();
28.88 - if (str == 0)
28.89 - {
28.90 - return false;
28.91 - }
28.92 - // attempt to convert back to value.
28.93 - Attribute v = info->checker->Create ();
28.94 - ok = v.DeserializeFromString (str->Get ().Get (), info->checker);
28.95 - if (!ok)
28.96 - {
28.97 - return false;
28.98 - }
28.99 - ok = info->checker->Check (v);
28.100 - if (!ok)
28.101 - {
28.102 - return false;
28.103 - }
28.104 - value = v;
28.105 + return false;
28.106 }
28.107 - DoSetOne (info->checker, value);
28.108 + ok = info->checker->Check (*v);
28.109 + if (!ok)
28.110 + {
28.111 + return false;
28.112 + }
28.113 + DoSetOne (info->checker, *v);
28.114 return true;
28.115 }
28.116 void
28.117 @@ -190,7 +192,7 @@
28.118 for (Attrs::const_iterator i = m_attributes.begin (); i != m_attributes.end ();)
28.119 {
28.120 std::string name = LookupAttributeFullNameByChecker (i->checker);
28.121 - oss << name << "=" << i->value.SerializeToString (i->checker);
28.122 + oss << name << "=" << i->value->SerializeToString (i->checker);
28.123 i++;
28.124 if (i != m_attributes.end ())
28.125 {
28.126 @@ -236,8 +238,8 @@
28.127 value = str.substr (equal+1, next - (equal+1));
28.128 cur++;
28.129 }
28.130 - Attribute val = info.checker->Create ();
28.131 - bool ok = val.DeserializeFromString (value, info.checker);
28.132 + Ptr<AttributeValue> val = info.checker->Create ();
28.133 + bool ok = val->DeserializeFromString (value, info.checker);
28.134 if (!ok)
28.135 {
28.136 // XXX invalid value
28.137 @@ -245,7 +247,7 @@
28.138 }
28.139 else
28.140 {
28.141 - DoSetOne (info.checker, val);
28.142 + DoSetOne (info.checker, *val);
28.143 }
28.144 }
28.145 }
29.1 --- a/src/core/attribute-list.h Mon Apr 14 16:19:17 2008 -0700
29.2 +++ b/src/core/attribute-list.h Thu Apr 17 13:42:25 2008 -0700
29.3 @@ -48,14 +48,14 @@
29.4 * value of that attribute. If any of these checks fails,
29.5 * the program terminates with a message.
29.6 */
29.7 - void Set (std::string name, Attribute value);
29.8 + void Set (std::string name, const AttributeValue &value);
29.9 /**
29.10 * \param name the full name of the attribute to set
29.11 * \param value the value to set
29.12 * \returns true if the requested attribute exists and could be
29.13 * stored, false otherwise.
29.14 */
29.15 - bool SetFailSafe (std::string name, Attribute value);
29.16 + bool SetFailSafe (std::string name, const AttributeValue &value);
29.17 /**
29.18 * \param tid the TypeId associated to this attribute
29.19 * \param name the name (not full!) of the attribute
29.20 @@ -66,7 +66,7 @@
29.21 * value of that attribute. If any of these checks fails,
29.22 * the program terminates with a message.
29.23 */
29.24 - void SetWithTid (TypeId tid, std::string name, Attribute value);
29.25 + void SetWithTid (TypeId tid, std::string name, const AttributeValue &value);
29.26
29.27 /**
29.28 * Clear the content of this instance.
29.29 @@ -92,7 +92,7 @@
29.30 friend class ObjectBase;
29.31 struct Attr {
29.32 Ptr<const AttributeChecker> checker;
29.33 - Attribute value;
29.34 + Ptr<const AttributeValue> value;
29.35 };
29.36 typedef std::vector<struct Attr> Attrs;
29.37 typedef Attrs::iterator Iterator;
29.38 @@ -100,8 +100,8 @@
29.39
29.40
29.41
29.42 - bool DoSet (struct TypeId::AttributeInfo *info, Attribute param);
29.43 - void DoSetOne (Ptr<const AttributeChecker> checker, Attribute param);
29.44 + bool DoSet (struct TypeId::AttributeInfo *info, const AttributeValue ¶m);
29.45 + void DoSetOne (Ptr<const AttributeChecker> checker, const AttributeValue ¶m);
29.46 std::string LookupAttributeFullNameByChecker (Ptr<const AttributeChecker> checker) const;
29.47
29.48 Attrs m_attributes;
30.1 --- a/src/core/attribute-test.cc Mon Apr 14 16:19:17 2008 -0700
30.2 +++ b/src/core/attribute-test.cc Thu Apr 17 13:42:25 2008 -0700
30.3 @@ -38,7 +38,6 @@
30.4 {
30.5 public:
30.6 ValueClassTest () {}
30.7 - ATTRIBUTE_HELPER_HEADER_1 (ValueClassTest);
30.8 private:
30.9 int m_v;
30.10 };
30.11 @@ -91,7 +90,7 @@
30.12 class AttributeObjectTest : public Object
30.13 {
30.14 public:
30.15 - enum TestEnum {
30.16 + enum Test_e {
30.17 TEST_A,
30.18 TEST_B,
30.19 TEST_C
30.20 @@ -101,65 +100,65 @@
30.21 .SetParent<Object> ()
30.22 .HideFromDocumentation ()
30.23 .AddAttribute ("TestBoolName", "help text",
30.24 - Boolean (false),
30.25 + BooleanValue (false),
30.26 MakeBooleanAccessor (&AttributeObjectTest::m_boolTest),
30.27 MakeBooleanChecker ())
30.28 .AddAttribute ("TestBoolA", "help text",
30.29 - Boolean (false),
30.30 + BooleanValue (false),
30.31 MakeBooleanAccessor (&AttributeObjectTest::DoSetTestB,
30.32 &AttributeObjectTest::DoGetTestB),
30.33 MakeBooleanChecker ())
30.34 .AddAttribute ("TestInt16", "help text",
30.35 - Integer (-2),
30.36 + IntegerValue (-2),
30.37 MakeIntegerAccessor (&AttributeObjectTest::m_int16),
30.38 MakeIntegerChecker<int16_t> ())
30.39 .AddAttribute ("TestInt16WithBounds", "help text",
30.40 - Integer (-2),
30.41 + IntegerValue (-2),
30.42 MakeIntegerAccessor (&AttributeObjectTest::m_int16WithBounds),
30.43 MakeIntegerChecker<int16_t> (-5, 10))
30.44 .AddAttribute ("TestInt16SetGet", "help text",
30.45 - Integer (6),
30.46 + IntegerValue (6),
30.47 MakeIntegerAccessor (&AttributeObjectTest::DoSetInt16,
30.48 &AttributeObjectTest::DoGetInt16),
30.49 MakeIntegerChecker<int16_t> ())
30.50 .AddAttribute ("TestUint8", "help text",
30.51 - Uinteger (1),
30.52 + UintegerValue (1),
30.53 MakeUintegerAccessor (&AttributeObjectTest::m_uint8),
30.54 MakeUintegerChecker<uint8_t> ())
30.55 .AddAttribute ("TestEnum", "help text",
30.56 - Enum (TEST_A),
30.57 + EnumValue (TEST_A),
30.58 MakeEnumAccessor (&AttributeObjectTest::m_enum),
30.59 MakeEnumChecker (TEST_A, "TestA",
30.60 TEST_B, "TestB",
30.61 TEST_C, "TestC"))
30.62 .AddAttribute ("TestRandom", "help text",
30.63 - ConstantVariable (1.0),
30.64 + RandomVariableValue (ConstantVariable (1.0)),
30.65 MakeRandomVariableAccessor (&AttributeObjectTest::m_random),
30.66 MakeRandomVariableChecker ())
30.67 .AddAttribute ("TestFloat", "help text",
30.68 - Double (-1.1),
30.69 + DoubleValue (-1.1),
30.70 MakeDoubleAccessor (&AttributeObjectTest::m_float),
30.71 MakeDoubleChecker<float> ())
30.72 .AddAttribute ("TestVector1", "help text",
30.73 - ObjectVector (),
30.74 + ObjectVectorValue (),
30.75 MakeObjectVectorAccessor (&AttributeObjectTest::m_vector1),
30.76 MakeObjectVectorChecker<Derived> ())
30.77 .AddAttribute ("TestVector2", "help text",
30.78 - ObjectVector (),
30.79 + ObjectVectorValue (),
30.80 MakeObjectVectorAccessor (&AttributeObjectTest::DoGetVectorN,
30.81 &AttributeObjectTest::DoGetVector),
30.82 MakeObjectVectorChecker<Derived> ())
30.83 .AddAttribute ("IntegerTraceSource1", "help text",
30.84 - Integer (-2),
30.85 + IntegerValue (-2),
30.86 MakeIntegerAccessor (&AttributeObjectTest::m_intSrc1),
30.87 MakeIntegerChecker<int8_t> ())
30.88 .AddAttribute ("IntegerTraceSource2", "help text",
30.89 - Integer (-2),
30.90 + IntegerValue (-2),
30.91 MakeIntegerAccessor (&AttributeObjectTest::DoSetIntSrc,
30.92 &AttributeObjectTest::DoGetIntSrc),
30.93 MakeIntegerChecker<int8_t> ())
30.94 .AddAttribute ("ValueClassSource", "help text",
30.95 - ValueClassTest (),
30.96 + ValueClassTestValue (ValueClassTest ()),
30.97 MakeValueClassTestAccessor (&AttributeObjectTest::m_valueSrc),
30.98 MakeValueClassTestChecker ())
30.99 .AddTraceSource ("Source1", "help test",
30.100 @@ -169,7 +168,7 @@
30.101 .AddTraceSource ("ValueSource", "help text",
30.102 MakeTraceSourceAccessor (&AttributeObjectTest::m_valueSrc))
30.103 .AddAttribute ("Pointer", "XXX",
30.104 - Pointer (),
30.105 + PointerValue (),
30.106 MakePointerAccessor (&AttributeObjectTest::m_ptr),
30.107 MakePointerChecker<Derived> ())
30.108 ;
30.109 @@ -220,7 +219,7 @@
30.110 int16_t m_int16SetGet;
30.111 uint8_t m_uint8;
30.112 float m_float;
30.113 - enum TestEnum m_enum;
30.114 + enum Test_e m_enum;
30.115 RandomVariable m_random;
30.116 std::vector<Ptr<Derived> > m_vector1;
30.117 std::vector<Ptr<Derived> > m_vector2;
30.118 @@ -232,22 +231,20 @@
30.119 };
30.120
30.121
30.122 -#define CHECK_GET_STR(p,name,value) \
30.123 - { \
30.124 - std::string expected = value; \
30.125 - std::string got; \
30.126 - bool ok = p->GetAttributeAsStringFailSafe (name, got); \
30.127 - NS_TEST_ASSERT (ok); \
30.128 - NS_TEST_ASSERT_EQUAL (got, expected); \
30.129 +#define CHECK_GET_STR(p,name,value) \
30.130 + { \
30.131 + std::string expected = value; \
30.132 + StringValue got; \
30.133 + bool ok = p->GetAttributeFailSafe (name, got); \
30.134 + NS_TEST_ASSERT (ok); \
30.135 + NS_TEST_ASSERT_EQUAL (got.Get (), expected); \
30.136 }
30.137 #define CHECK_GET_PARAM(p,name,type,value) \
30.138 { \
30.139 const type expected = value; \
30.140 - type got = value; \
30.141 - Attribute v; \
30.142 - bool ok = p->GetAttributeFailSafe (name, v); \
30.143 + type got; \
30.144 + bool ok = p->GetAttributeFailSafe (name, got); \
30.145 NS_TEST_ASSERT (ok); \
30.146 - got = v; \
30.147 NS_TEST_ASSERT_EQUAL (got.Get (), expected.Get ()); \
30.148 }
30.149
30.150 @@ -263,194 +260,199 @@
30.151
30.152 AttributeList params;
30.153 Ptr<AttributeObjectTest> p;
30.154 - NS_TEST_ASSERT (params.SetFailSafe ("ns3::AttributeObjectTest::TestBoolName", String ("false")));
30.155 + NS_TEST_ASSERT (params.SetFailSafe ("ns3::AttributeObjectTest::TestBoolName", StringValue ("false")));
30.156 p = CreateObject<AttributeObjectTest> (params);
30.157 CHECK_GET_STR (p, "TestBoolName", "false");
30.158 - CHECK_GET_PARAM (p, "TestBoolName", Boolean, false);
30.159 + CHECK_GET_PARAM (p, "TestBoolName", BooleanValue, false);
30.160
30.161 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestBoolName", String ("true")));
30.162 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestBoolName", StringValue ("true")));
30.163 CHECK_GET_STR (p, "TestBoolName", "true");
30.164 - CHECK_GET_PARAM (p, "TestBoolName", Boolean, true);
30.165 + CHECK_GET_PARAM (p, "TestBoolName", BooleanValue, true);
30.166
30.167 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestBoolName", Boolean (false)));
30.168 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestBoolName", BooleanValue (false)));
30.169 CHECK_GET_STR (p, "TestBoolName", "false");
30.170 - CHECK_GET_PARAM (p, "TestBoolName", Boolean, false);
30.171 + CHECK_GET_PARAM (p, "TestBoolName", BooleanValue, false);
30.172
30.173 - p = CreateObject<AttributeObjectTest> ("TestBoolName", String ("true"));
30.174 + p = CreateObject<AttributeObjectTest> ("TestBoolName", StringValue ("true"));
30.175 CHECK_GET_STR (p, "TestBoolName", "true");
30.176 - CHECK_GET_PARAM (p, "TestBoolName", Boolean, true);
30.177 + CHECK_GET_PARAM (p, "TestBoolName", BooleanValue, true);
30.178
30.179 - p = CreateObject<AttributeObjectTest> ("TestBoolName", Boolean (true));
30.180 + p = CreateObject<AttributeObjectTest> ("TestBoolName", BooleanValue (true));
30.181 CHECK_GET_STR (p, "TestBoolName", "true");
30.182 - CHECK_GET_PARAM (p, "TestBoolName", Boolean, true);
30.183 + CHECK_GET_PARAM (p, "TestBoolName", BooleanValue, true);
30.184
30.185 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestBoolA", String ("false")));
30.186 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestBoolA", StringValue ("false")));
30.187 CHECK_GET_STR (p, "TestBoolA", "false");
30.188 - CHECK_GET_PARAM (p, "TestBoolA", Boolean, false);
30.189 + CHECK_GET_PARAM (p, "TestBoolA", BooleanValue, false);
30.190
30.191 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestBoolA", String ("true")));
30.192 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestBoolA", StringValue ("true")));
30.193 CHECK_GET_STR (p, "TestBoolA", "true");
30.194 - CHECK_GET_PARAM (p, "TestBoolA", Boolean, true);
30.195 + CHECK_GET_PARAM (p, "TestBoolA", BooleanValue, true);
30.196
30.197
30.198 CHECK_GET_STR (p, "TestInt16", "-2");
30.199 - CHECK_GET_PARAM (p, "TestInt16", Integer, -2);
30.200 + CHECK_GET_PARAM (p, "TestInt16", IntegerValue, -2);
30.201
30.202 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16", String ("-5")));
30.203 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16", StringValue ("-5")));
30.204 CHECK_GET_STR (p, "TestInt16", "-5");
30.205 - CHECK_GET_PARAM (p, "TestInt16", Integer, -5);
30.206 + CHECK_GET_PARAM (p, "TestInt16", IntegerValue, -5);
30.207
30.208 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16", Integer (+2)));
30.209 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16", IntegerValue (+2)));
30.210 CHECK_GET_STR (p, "TestInt16", "2");
30.211 - CHECK_GET_PARAM (p, "TestInt16", Integer, +2);
30.212 + CHECK_GET_PARAM (p, "TestInt16", IntegerValue, +2);
30.213
30.214 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16", Integer (-32768)));
30.215 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16", IntegerValue (-32768)));
30.216 CHECK_GET_STR (p, "TestInt16", "-32768");
30.217 - CHECK_GET_PARAM (p, "TestInt16", Integer, -32768);
30.218 + CHECK_GET_PARAM (p, "TestInt16", IntegerValue, -32768);
30.219
30.220 - NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestInt16", Integer (-32769)));
30.221 + NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestInt16", IntegerValue (-32769)));
30.222 CHECK_GET_STR (p, "TestInt16", "-32768");
30.223 - CHECK_GET_PARAM (p, "TestInt16", Integer, -32768);
30.224 + CHECK_GET_PARAM (p, "TestInt16", IntegerValue, -32768);
30.225
30.226 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16", Integer (32767)));
30.227 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16", IntegerValue (32767)));
30.228 CHECK_GET_STR (p, "TestInt16", "32767");
30.229 - CHECK_GET_PARAM (p, "TestInt16", Integer, 32767);
30.230 + CHECK_GET_PARAM (p, "TestInt16", IntegerValue, 32767);
30.231
30.232 - NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestInt16", Integer (32768)));
30.233 + NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestInt16", IntegerValue (32768)));
30.234 CHECK_GET_STR (p, "TestInt16", "32767");
30.235 - CHECK_GET_PARAM (p, "TestInt16", Integer, 32767);
30.236 + CHECK_GET_PARAM (p, "TestInt16", IntegerValue, 32767);
30.237
30.238 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16WithBounds", Integer (10)));
30.239 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16WithBounds", IntegerValue (10)));
30.240 CHECK_GET_STR (p, "TestInt16WithBounds", "10");
30.241 - CHECK_GET_PARAM (p, "TestInt16WithBounds", Integer, 10);
30.242 - NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestInt16WithBounds", Integer (11)));
30.243 + CHECK_GET_PARAM (p, "TestInt16WithBounds", IntegerValue, 10);
30.244 + NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestInt16WithBounds", IntegerValue (11)));
30.245 CHECK_GET_STR (p, "TestInt16WithBounds", "10");
30.246 - CHECK_GET_PARAM (p, "TestInt16WithBounds", Integer, 10);
30.247 + CHECK_GET_PARAM (p, "TestInt16WithBounds", IntegerValue, 10);
30.248
30.249 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16WithBounds", Integer (-5)));
30.250 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16WithBounds", IntegerValue (-5)));
30.251 CHECK_GET_STR (p, "TestInt16WithBounds", "-5");
30.252 - CHECK_GET_PARAM (p, "TestInt16WithBounds", Integer, -5);
30.253 - NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestInt16WithBounds", Integer (-6)));
30.254 + CHECK_GET_PARAM (p, "TestInt16WithBounds", IntegerValue, -5);
30.255 + NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestInt16WithBounds", IntegerValue (-6)));
30.256 CHECK_GET_STR (p, "TestInt16WithBounds", "-5");
30.257 - CHECK_GET_PARAM (p, "TestInt16WithBounds", Integer, -5);
30.258 + CHECK_GET_PARAM (p, "TestInt16WithBounds", IntegerValue, -5);
30.259
30.260 CHECK_GET_STR (p, "TestInt16SetGet", "6");
30.261 - CHECK_GET_PARAM (p, "TestInt16SetGet", Integer, 6);
30.262 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16SetGet", Integer (0)));
30.263 + CHECK_GET_PARAM (p, "TestInt16SetGet", IntegerValue, 6);
30.264 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestInt16SetGet", IntegerValue (0)));
30.265 CHECK_GET_STR (p, "TestInt16SetGet", "0");
30.266 - CHECK_GET_PARAM (p, "TestInt16SetGet", Integer, 0);
30.267 + CHECK_GET_PARAM (p, "TestInt16SetGet", IntegerValue, 0);
30.268
30.269 CHECK_GET_STR (p, "TestUint8", "1");
30.270 - CHECK_GET_PARAM (p, "TestUint8", Uinteger, 1);
30.271 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestUint8", Uinteger (0)));
30.272 + CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 1);
30.273 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestUint8", UintegerValue (0)));
30.274 CHECK_GET_STR (p, "TestUint8", "0");
30.275 - CHECK_GET_PARAM (p, "TestUint8", Uinteger, 0);
30.276 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestUint8", Uinteger (255)));
30.277 + CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 0);
30.278 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestUint8", UintegerValue (255)));
30.279 CHECK_GET_STR (p, "TestUint8", "255");
30.280 - CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255);
30.281 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestUint8", String ("255")));
30.282 + CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 255);
30.283 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestUint8", StringValue ("255")));
30.284 CHECK_GET_STR (p, "TestUint8", "255");
30.285 - CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255);
30.286 - NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestUint8", String ("256")));
30.287 + CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 255);
30.288 + NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestUint8", StringValue ("256")));
30.289 CHECK_GET_STR (p, "TestUint8", "255");
30.290 - CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255);
30.291 - NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestUint8", String ("-1")));
30.292 + CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 255);
30.293 + NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestUint8", StringValue ("-1")));
30.294 CHECK_GET_STR (p, "TestUint8", "255");
30.295 - CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255);
30.296 - NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestUint8", Uinteger ((uint64_t)-1)));
30.297 + CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 255);
30.298 + NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestUint8", UintegerValue ((uint64_t)-1)));
30.299 CHECK_GET_STR (p, "TestUint8", "255");
30.300 - CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255);
30.301 + CHECK_GET_PARAM (p, "TestUint8", UintegerValue, 255);
30.302
30.303 CHECK_GET_STR (p, "TestFloat", "-1.1");
30.304 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestFloat", Double ((float)+2.3)));
30.305 - CHECK_GET_PARAM (p, "TestFloat", Double, (float)+2.3);
30.306 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestFloat", DoubleValue ((float)+2.3)));
30.307 + CHECK_GET_PARAM (p, "TestFloat", DoubleValue, (float)+2.3);
30.308
30.309 CHECK_GET_STR (p, "TestEnum", "TestA");
30.310 - CHECK_GET_PARAM (p, "TestEnum", Enum, AttributeObjectTest::TEST_A);
30.311 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestEnum", Enum (AttributeObjectTest::TEST_C)));
30.312 + CHECK_GET_PARAM (p, "TestEnum", EnumValue, AttributeObjectTest::TEST_A);
30.313 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestEnum", EnumValue (AttributeObjectTest::TEST_C)));
30.314 CHECK_GET_STR (p, "TestEnum", "TestC");
30.315 - CHECK_GET_PARAM (p, "TestEnum", Enum, AttributeObjectTest::TEST_C);
30.316 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestEnum", String ("TestB")));
30.317 + CHECK_GET_PARAM (p, "TestEnum", EnumValue, AttributeObjectTest::TEST_C);
30.318 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestEnum", StringValue ("TestB")));
30.319 CHECK_GET_STR (p, "TestEnum", "TestB");
30.320 - CHECK_GET_PARAM (p, "TestEnum", Enum, AttributeObjectTest::TEST_B);
30.321 - NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestEnum", String ("TestD")));
30.322 + CHECK_GET_PARAM (p, "TestEnum", EnumValue, AttributeObjectTest::TEST_B);
30.323 + NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestEnum", StringValue ("TestD")));
30.324 CHECK_GET_STR (p, "TestEnum", "TestB");
30.325 - CHECK_GET_PARAM (p, "TestEnum", Enum, AttributeObjectTest::TEST_B);
30.326 - NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestEnum", Enum (5)));
30.327 + CHECK_GET_PARAM (p, "TestEnum", EnumValue, AttributeObjectTest::TEST_B);
30.328 + NS_TEST_ASSERT (!p->SetAttributeFailSafe("TestEnum", EnumValue (5)));
30.329 CHECK_GET_STR (p, "TestEnum", "TestB");
30.330 - CHECK_GET_PARAM (p, "TestEnum", Enum, AttributeObjectTest::TEST_B);
30.331 + CHECK_GET_PARAM (p, "TestEnum", EnumValue, AttributeObjectTest::TEST_B);
30.332
30.333 - RandomVariable ran = p->GetAttribute ("TestRandom");
30.334 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestRandom", UniformVariable (0.0, 1.0)));
30.335 - NS_TEST_ASSERT (p->SetAttributeFailSafe("TestRandom", ConstantVariable (10.0)));
30.336 + RandomVariableValue ran;
30.337 + p->GetAttribute ("TestRandom", ran);
30.338 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestRandom", RandomVariableValue (UniformVariable (0.0, 1.0))));
30.339 + NS_TEST_ASSERT (p->SetAttributeFailSafe("TestRandom", RandomVariableValue (ConstantVariable (10.0))));
30.340
30.341 {
30.342 - ObjectVector vector = p->GetAttribute ("TestVector1");
30.343 + ObjectVectorValue vector;
30.344 + p->GetAttribute ("TestVector1", vector);
30.345 NS_TEST_ASSERT_EQUAL (vector.GetN (), 0);
30.346 p->AddToVector1 ();
30.347 NS_TEST_ASSERT_EQUAL (vector.GetN (), 0);
30.348 - vector = p->GetAttribute ("TestVector1");
30.349 + p->GetAttribute ("TestVector1", vector);
30.350 NS_TEST_ASSERT_EQUAL (vector.GetN (), 1);
30.351 Ptr<Object> a = vector.Get (0);
30.352 NS_TEST_ASSERT_UNEQUAL (a, 0);
30.353 p->AddToVector1 ();
30.354 NS_TEST_ASSERT_EQUAL (vector.GetN (), 1);
30.355 - vector = p->GetAttribute ("TestVector1");
30.356 + p->GetAttribute ("TestVector1", vector);
30.357 NS_TEST_ASSERT_EQUAL (vector.GetN (), 2);
30.358 }
30.359
30.360 {
30.361 - ObjectVector vector = p->GetAttribute ("TestVector2");
30.362 + ObjectVectorValue vector;
30.363 + p->GetAttribute ("TestVector2", vector);
30.364 NS_TEST_ASSERT_EQUAL (vector.GetN (), 0);
30.365 p->AddToVector2 ();
30.366 NS_TEST_ASSERT_EQUAL (vector.GetN (), 0);
30.367 - vector = p->GetAttribute ("TestVector2");
30.368 + p->GetAttribute ("TestVector2", vector);
30.369 NS_TEST_ASSERT_EQUAL (vector.GetN (), 1);
30.370 Ptr<Object> a = vector.Get (0);
30.371 NS_TEST_ASSERT_UNEQUAL (a, 0);
30.372 p->AddToVector2 ();
30.373 NS_TEST_ASSERT_EQUAL (vector.GetN (), 1);
30.374 - vector = p->GetAttribute ("TestVector2");
30.375 + p->GetAttribute ("TestVector2", vector);
30.376 NS_TEST_ASSERT_EQUAL (vector.GetN (), 2);
30.377 }
30.378
30.379 - NS_TEST_ASSERT (AttributeList::GetGlobal ()->SetFailSafe ("ns3::AttributeObjectTest::TestBoolName", String ("true")));
30.380 + NS_TEST_ASSERT (AttributeList::GetGlobal ()->SetFailSafe ("ns3::AttributeObjectTest::TestBoolName", StringValue ("true")));
30.381 p = CreateObject<AttributeObjectTest> ();
30.382 - Boolean boolV = p->GetAttribute ("TestBoolName");
30.383 - NS_TEST_ASSERT_EQUAL (boolV, Boolean (true));
30.384 + BooleanValue boolV;
30.385 + p->GetAttribute ("TestBoolName", boolV);
30.386 + NS_TEST_ASSERT_EQUAL (boolV.Get (), true);
30.387
30.388 - NS_TEST_ASSERT (AttributeList::GetGlobal ()->SetFailSafe ("ns3::AttributeObjectTest::TestBoolName", String ("false")));
30.389 + NS_TEST_ASSERT (AttributeList::GetGlobal ()->SetFailSafe ("ns3::AttributeObjectTest::TestBoolName", StringValue ("false")));
30.390 p = CreateObject<AttributeObjectTest> ();
30.391 - boolV = p->GetAttribute ("TestBoolName");
30.392 - NS_TEST_ASSERT_EQUAL (boolV, Boolean (false));
30.393 + p->GetAttribute ("TestBoolName", boolV);
30.394 + NS_TEST_ASSERT_EQUAL (boolV.Get (), false);
30.395
30.396 - Integer i = p->GetAttribute ("IntegerTraceSource1");
30.397 + IntegerValue i;
30.398 + p->GetAttribute ("IntegerTraceSource1", i);
30.399 NS_TEST_ASSERT_EQUAL (i.Get (), -2);
30.400 - NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", Integer (+5)));
30.401 - i = p->GetAttribute ("IntegerTraceSource1");
30.402 + NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (+5)));
30.403 + p->GetAttribute ("IntegerTraceSource1", i);
30.404 NS_TEST_ASSERT_EQUAL (i.Get (), +5);
30.405 - NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", Integer (127)));
30.406 - NS_TEST_ASSERT (!p->SetAttributeFailSafe ("IntegerTraceSource1", Integer (128)));
30.407 - NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", Integer (-128)));
30.408 - NS_TEST_ASSERT (!p->SetAttributeFailSafe ("IntegerTraceSource1", Integer (-129)));
30.409 + NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (127)));
30.410 + NS_TEST_ASSERT (!p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (128)));
30.411 + NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (-128)));
30.412 + NS_TEST_ASSERT (!p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (-129)));
30.413
30.414 - i = p->GetAttribute ("IntegerTraceSource2");
30.415 + p->GetAttribute ("IntegerTraceSource2", i);
30.416 NS_TEST_ASSERT_EQUAL (i.Get (), -2);
30.417 - NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource2", Integer (+5)));
30.418 - i = p->GetAttribute ("IntegerTraceSource2");
30.419 + NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (+5)));
30.420 + p->GetAttribute ("IntegerTraceSource2", i);
30.421 NS_TEST_ASSERT_EQUAL (i.Get (), +5);
30.422 - NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource2", Integer (127)));
30.423 - NS_TEST_ASSERT (!p->SetAttributeFailSafe ("IntegerTraceSource2", Integer (128)));
30.424 - NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource2", Integer (-128)));
30.425 - NS_TEST_ASSERT (!p->SetAttributeFailSafe ("IntegerTraceSource2", Integer (-129)));
30.426 + NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (127)));
30.427 + NS_TEST_ASSERT (!p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (128)));
30.428 + NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (-128)));
30.429 + NS_TEST_ASSERT (!p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (-129)));
30.430
30.431 m_got1 = -2;
30.432 - NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", Integer (-1)));
30.433 + NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (-1)));
30.434 NS_TEST_ASSERT (p->TraceConnectWithoutContext ("Source1", MakeCallback (&AttributeTest::NotifySource1, this)));
30.435 - NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", Integer (0)));
30.436 + NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (0)));
30.437 NS_TEST_ASSERT_EQUAL (m_got1, 0);
30.438 NS_TEST_ASSERT (p->TraceDisconnectWithoutContext ("Source1", MakeCallback (&AttributeTest::NotifySource1, this)));
30.439 - NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", Integer (1)));
30.440 + NS_TEST_ASSERT (p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (1)));
30.441 NS_TEST_ASSERT_EQUAL (m_got1, 0);
30.442
30.443 m_got2 = 4.3;
30.444 @@ -466,24 +468,28 @@
30.445
30.446 NS_TEST_ASSERT (p->TraceConnectWithoutContext ("ValueSource", MakeCallback (&AttributeTest::NotifySourceValue, this)));
30.447
30.448 - Ptr<Derived>derived = Pointer (p->GetAttribute ("Pointer"));
30.449 + PointerValue ptr;
30.450 + p->GetAttribute ("Pointer", ptr);
30.451 + Ptr<Derived> derived = ptr.Get<Derived> ();
30.452 NS_TEST_ASSERT (derived == 0);
30.453 derived = Create<Derived> ();
30.454 - NS_TEST_ASSERT (p->SetAttributeFailSafe("Pointer", Pointer (derived)));
30.455 - Ptr<Derived> stored = Pointer (p->GetAttribute ("Pointer"));
30.456 + NS_TEST_ASSERT (p->SetAttributeFailSafe("Pointer", PointerValue (derived)));
30.457 + p->GetAttribute ("Pointer", ptr);
30.458 + Ptr<Derived> stored = ptr.Get<Derived> ();
30.459 NS_TEST_ASSERT (stored == derived);
30.460 - Ptr<Object> storedBase = Pointer (p->GetAttribute ("Pointer"));
30.461 + p->GetAttribute ("Pointer", ptr);
30.462 + Ptr<Object> storedBase = ptr.Get<Object> ();
30.463 NS_TEST_ASSERT (stored == storedBase);
30.464 - Ptr<AttributeObjectTest> x = Pointer (p->GetAttribute ("Pointer"));
30.465 + p->GetAttribute ("Pointer", ptr);
30.466 + Ptr<AttributeObjectTest> x = ptr.Get<AttributeObjectTest> ();
30.467 NS_TEST_ASSERT (x == 0);
30.468
30.469 - p = CreateObject<AttributeObjectTest> ("Pointer", Pointer (Create<Derived> ()));
30.470 + p = CreateObject<AttributeObjectTest> ("Pointer", PointerValue (Create<Derived> ()));
30.471 NS_TEST_ASSERT (p != 0);
30.472 derived = 0;
30.473 - derived = Pointer (p->GetAttribute ("Pointer"));
30.474 + p->GetAttribute ("Pointer", ptr);
30.475 + derived = ptr.Get<Derived> ();
30.476 NS_TEST_ASSERT (derived != 0);
30.477 -
30.478 -
30.479
30.480 return result;
30.481 }
31.1 --- a/src/core/attribute.cc Mon Apr 14 16:19:17 2008 -0700
31.2 +++ b/src/core/attribute.cc Thu Apr 17 13:42:25 2008 -0700
31.3 @@ -31,28 +31,6 @@
31.4 AttributeValue::~AttributeValue ()
31.5 {}
31.6
31.7 -Attribute::Attribute ()
31.8 - : m_value ()
31.9 -{}
31.10 -Attribute::Attribute (Ptr<AttributeValue> value)
31.11 - : m_value (value)
31.12 -{}
31.13 -
31.14 -Attribute
31.15 -Attribute::Copy (void) const
31.16 -{
31.17 - return m_value->Copy ();
31.18 -}
31.19 -std::string
31.20 -Attribute::SerializeToString (Ptr<const AttributeChecker> checker) const
31.21 -{
31.22 - return m_value->SerializeToString (checker);
31.23 -}
31.24 -bool
31.25 -Attribute::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
31.26 -{
31.27 - return m_value->DeserializeFromString (value, checker);
31.28 -}
31.29
31.30 AttributeAccessor::AttributeAccessor ()
31.31 {}
31.32 @@ -64,4 +42,23 @@
31.33 AttributeChecker::~AttributeChecker ()
31.34 {}
31.35
31.36 +EmptyAttributeValue::EmptyAttributeValue ()
31.37 +{}
31.38 +Ptr<AttributeValue>
31.39 +EmptyAttributeValue::Copy (void) const
31.40 +{
31.41 + return Create<EmptyAttributeValue> ();
31.42 +}
31.43 +std::string
31.44 +EmptyAttributeValue::SerializeToString (Ptr<const AttributeChecker> checker) const
31.45 +{
31.46 + return "";
31.47 +}
31.48 +bool
31.49 +EmptyAttributeValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
31.50 +{
31.51 + return true;
31.52 +}
31.53 +
31.54 +
31.55 } // namespace ns3
32.1 --- a/src/core/attribute.h Mon Apr 14 16:19:17 2008 -0700
32.2 +++ b/src/core/attribute.h Thu Apr 17 13:42:25 2008 -0700
32.3 @@ -48,7 +48,7 @@
32.4 /**
32.5 * \returns a deep copy of this class, wrapped into an Attribute object.
32.6 */
32.7 - virtual Attribute Copy (void) const = 0;
32.8 + virtual Ptr<AttributeValue> Copy (void) const = 0;
32.9 /**
32.10 * \param checker the checker associated to the attribute
32.11 * \returns a string representation of this value.
32.12 @@ -73,52 +73,6 @@
32.13 * the EnumValue::SerializeToString code.
32.14 */
32.15 virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker) = 0;
32.16 -private:
32.17 - friend class Attribute;
32.18 -};
32.19 -
32.20 -/**
32.21 - * \brief an opaque wrapper around a value to set or retrieved
32.22 - * from an attribute.
32.23 - *
32.24 - * This class is really a smart pointer to an instance of AttributeValue.
32.25 - * Of course, the question is "why not use a Ptr<AttributeValue>" ?. The
32.26 - * answer is long and complicated but the crux of the issue is that if we
32.27 - * do not reproduce the smart pointer code in this class, we cannot provide
32.28 - * transparent handling of Ptr<T> values through the attribute system.
32.29 - */
32.30 -class Attribute
32.31 -{
32.32 -public:
32.33 - Attribute ();
32.34 -
32.35 - /**
32.36 - * Forward to AttributeValue::Copy
32.37 - */
32.38 - Attribute Copy (void) const;
32.39 - /**
32.40 - * Forward to AttributeValue::SerializeToString
32.41 - */
32.42 - std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
32.43 - /**
32.44 - * Forward to AttributeValue::DeserializeFromString
32.45 - */
32.46 - bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
32.47 -
32.48 -
32.49 - /**
32.50 - * This method performs a dynamic_cast on the underlying AttributeValue.
32.51 - * This method is typically used to implement conversion operators
32.52 - * from the type Attribute. In most cases, these conversion operators
32.53 - * will be generated for you by the ATTRIBUTE_HELPER_* macros.
32.54 - * \returns the casted pointer.
32.55 - */
32.56 - template <typename T>
32.57 - T DynCast (void) const;
32.58 -
32.59 - Attribute (Ptr<AttributeValue> value);
32.60 -private:
32.61 - Ptr<AttributeValue> m_value;
32.62 };
32.63
32.64 /**
32.65 @@ -143,7 +97,7 @@
32.66 * This method expects that the caller has checked that the input value is
32.67 * valid with AttributeChecker::Check.
32.68 */
32.69 - virtual bool Set (ObjectBase * object, Attribute value) const = 0;
32.70 + virtual bool Set (ObjectBase * object, const AttributeValue &value) const = 0;
32.71 /**
32.72 * \param object the object instance to get the value from
32.73 * \param attribute a pointer to where the value should be set.
32.74 @@ -153,7 +107,7 @@
32.75 * This method expects that the caller has checked that the input value is
32.76 * valid with AttributeChecker::Check.
32.77 */
32.78 - virtual bool Get (const ObjectBase * object, Attribute attribute) const = 0;
32.79 + virtual bool Get (const ObjectBase * object, AttributeValue &attribute) const = 0;
32.80
32.81 /**
32.82 * \return true if this accessor supports the Get operation, false
32.83 @@ -190,7 +144,7 @@
32.84 * and if its value is within the requested range. Returns
32.85 * false otherwise.
32.86 */
32.87 - virtual bool Check (Attribute value) const = 0;
32.88 + virtual bool Check (const AttributeValue &value) const = 0;
32.89 virtual std::string GetType (void) const = 0;
32.90 virtual bool HasTypeConstraints (void) const = 0;
32.91 virtual std::string GetTypeConstraints (void) const = 0;
32.92 @@ -201,25 +155,22 @@
32.93 * This method is typically used to create a temporary variable prior
32.94 * to calling Attribute::DeserializeFromString.
32.95 */
32.96 - virtual Attribute Create (void) const = 0;
32.97 + virtual Ptr<AttributeValue> Create (void) const = 0;
32.98 +
32.99 + virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const = 0;
32.100 +
32.101 +};
32.102 +
32.103 +class EmptyAttributeValue : public AttributeValue
32.104 +{
32.105 +public:
32.106 + EmptyAttributeValue ();
32.107 +private:
32.108 + virtual Ptr<AttributeValue> Copy (void) const;
32.109 + virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
32.110 + virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
32.111 };
32.112
32.113 } // namespace ns3
32.114
32.115 -namespace ns3 {
32.116 -
32.117 -/********************************************************
32.118 - * The implementation of the Attribute
32.119 - * class template methods.
32.120 - ********************************************************/
32.121 -
32.122 -template <typename T>
32.123 -T
32.124 -Attribute::DynCast (void) const
32.125 -{
32.126 - return dynamic_cast<T> (PeekPointer (m_value));
32.127 -}
32.128 -
32.129 -} // namespace ns3
32.130 -
32.131 #endif /* ATTRIBUTE_H */
33.1 --- a/src/core/boolean.cc Mon Apr 14 16:19:17 2008 -0700
33.2 +++ b/src/core/boolean.cc Thu Apr 17 13:42:25 2008 -0700
33.3 @@ -22,28 +22,28 @@
33.4
33.5 namespace ns3 {
33.6
33.7 -Boolean::Boolean ()
33.8 +BooleanValue::BooleanValue ()
33.9 : m_value (false)
33.10 {}
33.11 -Boolean::Boolean (bool value)
33.12 +BooleanValue::BooleanValue (bool value)
33.13 : m_value (value)
33.14 {}
33.15 void
33.16 -Boolean::Set (bool value)
33.17 +BooleanValue::Set (bool value)
33.18 {
33.19 m_value = value;
33.20 }
33.21 bool
33.22 -Boolean::Get (void) const
33.23 +BooleanValue::Get (void) const
33.24 {
33.25 return m_value;
33.26 }
33.27 -Boolean::operator bool () const
33.28 +BooleanValue::operator bool () const
33.29 {
33.30 return m_value;
33.31 }
33.32
33.33 -std::ostream & operator << (std::ostream &os, const Boolean &value)
33.34 +std::ostream & operator << (std::ostream &os, const BooleanValue &value)
33.35 {
33.36 if (value.Get ())
33.37 {
33.38 @@ -55,31 +55,48 @@
33.39 }
33.40 return os;
33.41 }
33.42 -std::istream & operator >> (std::istream &is, Boolean &value)
33.43 +
33.44 +Ptr<AttributeValue>
33.45 +BooleanValue::Copy (void) const
33.46 {
33.47 - std::string v;
33.48 - is >> v;
33.49 - if (v == "true" ||
33.50 - v == "1" ||
33.51 - v == "t")
33.52 + return Create<BooleanValue> (*this);
33.53 +}
33.54 +std::string
33.55 +BooleanValue::SerializeToString (Ptr<const AttributeChecker> checker) const
33.56 +{
33.57 + if (m_value)
33.58 {
33.59 - value.Set (true);
33.60 + return "true";
33.61 + }
33.62 + else
33.63 + {
33.64 + return "false";
33.65 }
33.66 - else if (v == "false" ||
33.67 - v == "0" ||
33.68 - v == "f")
33.69 +}
33.70 +bool
33.71 +BooleanValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
33.72 +{
33.73 + if (value == "true" ||
33.74 + value == "1" ||
33.75 + value == "t")
33.76 {
33.77 - value.Set (false);
33.78 + m_value = true;
33.79 + return true;
33.80 + }
33.81 + else if (value == "false" ||
33.82 + value == "0" ||
33.83 + value == "f")
33.84 + {
33.85 + m_value = false;
33.86 + return true;
33.87 }
33.88 else
33.89 {
33.90 - is.setstate (std::ios_base::badbit);
33.91 + return false;
33.92 }
33.93 - return is;
33.94 }
33.95
33.96 -ATTRIBUTE_CONVERTER_IMPLEMENT (Boolean);
33.97 -ATTRIBUTE_VALUE_IMPLEMENT (Boolean);
33.98 +
33.99 ATTRIBUTE_CHECKER_IMPLEMENT (Boolean);
33.100
33.101 } // namespace ns3
34.1 --- a/src/core/boolean.h Mon Apr 14 16:19:17 2008 -0700
34.2 +++ b/src/core/boolean.h Thu Apr 17 13:42:25 2008 -0700
34.3 @@ -33,25 +33,25 @@
34.4 * This class can be used to hold bool variables
34.5 * which must go through the Attribute system.
34.6 */
34.7 -class Boolean
34.8 +class BooleanValue : public AttributeValue
34.9 {
34.10 public:
34.11 - Boolean ();
34.12 - Boolean (bool value);
34.13 + BooleanValue ();
34.14 + BooleanValue (bool value);
34.15 void Set (bool value);
34.16 bool Get (void) const;
34.17 -
34.18 +
34.19 operator bool () const;
34.20
34.21 - ATTRIBUTE_CONVERTER_DEFINE (Boolean);
34.22 + virtual Ptr<AttributeValue> Copy (void) const;
34.23 + virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
34.24 + virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
34.25 private:
34.26 bool m_value;
34.27 };
34.28
34.29 -std::ostream & operator << (std::ostream &os, const Boolean &value);
34.30 -std::istream & operator >> (std::istream &is, Boolean &value);
34.31 +std::ostream & operator << (std::ostream &os, const BooleanValue &value);
34.32
34.33 -ATTRIBUTE_VALUE_DEFINE (Boolean);
34.34 ATTRIBUTE_CHECKER_DEFINE (Boolean);
34.35 ATTRIBUTE_ACCESSOR_DEFINE (Boolean);
34.36
35.1 --- a/src/core/command-line.cc Mon Apr 14 16:19:17 2008 -0700
35.2 +++ b/src/core/command-line.cc Thu Apr 17 13:42:25 2008 -0700
35.3 @@ -21,6 +21,7 @@
35.4 #include "log.h"
35.5 #include "config.h"
35.6 #include "global-value.h"
35.7 +#include "type-id.h"
35.8 #include "string.h"
35.9 #include <stdlib.h>
35.10
35.11 @@ -109,8 +110,9 @@
35.12 {
35.13 std::cout << " --" << (*i)->GetName () << "=[";
35.14 Ptr<const AttributeChecker> checker = (*i)->GetChecker ();
35.15 - Attribute value = (*i)->GetValue ();
35.16 - std::cout << value.SerializeToString (checker) << "]: "
35.17 + StringValue v;
35.18 + (*i)->GetValue (v);
35.19 + std::cout << v.Get () << "]: "
35.20 << (*i)->GetHelp () << std::endl;
35.21 }
35.22 exit (0);
35.23 @@ -128,8 +130,8 @@
35.24 {
35.25 std::cout << " --"<<tid.GetAttributeFullName (i)<<"=[";
35.26 Ptr<const AttributeChecker> checker = tid.GetAttributeChecker (i);
35.27 - Attribute initial = tid.GetAttributeInitialValue (i);
35.28 - std::cout << initial.SerializeToString (checker) << "]: "
35.29 + Ptr<const AttributeValue> initial = tid.GetAttributeInitialValue (i);
35.30 + std::cout << initial->SerializeToString (checker) << "]: "
35.31 << tid.GetAttributeHelp (i) << std::endl;
35.32 }
35.33 exit (0);
35.34 @@ -243,8 +245,8 @@
35.35 }
35.36 }
35.37 }
35.38 - if (!Config::SetGlobalFailSafe (name, String (value))
35.39 - && !Config::SetDefaultFailSafe (name, String (value)))
35.40 + if (!Config::SetGlobalFailSafe (name, StringValue (value))
35.41 + && !Config::SetDefaultFailSafe (name, StringValue (value)))
35.42 {
35.43 std::cerr << "Invalid command-line arguments: --"<<name<<"="<<value<<std::endl;
35.44 PrintHelp ();
36.1 --- a/src/core/config.cc Mon Apr 14 16:19:17 2008 -0700
36.2 +++ b/src/core/config.cc Thu Apr 17 13:42:25 2008 -0700
36.3 @@ -126,7 +126,7 @@
36.4 void Resolve (Ptr<Object> root);
36.5 private:
36.6 void DoResolve (std::string path, Ptr<Object> root);
36.7 - void DoArrayResolve (std::string path, const ObjectVector &vector);
36.8 + void DoArrayResolve (std::string path, const ObjectVectorValue &vector);
36.9 void DoResolveOne (Ptr<Object> object, std::string name);
36.10 std::string GetResolvedPath (std::string name) const;
36.11 virtual void DoOne (Ptr<Object> object, std::string path, std::string name) = 0;
36.12 @@ -218,7 +218,9 @@
36.13 if (ptr != 0)
36.14 {
36.15 NS_LOG_DEBUG ("GetAttribute(ptr)="<<item<<" on path="<<GetResolvedPath (""));
36.16 - Ptr<Object> object = Pointer (root->GetAttribute (item));
36.17 + PointerValue ptr;
36.18 + root->GetAttribute (item, ptr);
36.19 + Ptr<Object> object = ptr.Get<Object> ();
36.20 if (object == 0)
36.21 {
36.22 NS_LOG_ERROR ("Requested object name=\""<<item<<
36.23 @@ -235,7 +237,8 @@
36.24 if (vectorChecker != 0)
36.25 {
36.26 NS_LOG_DEBUG ("GetAttribute(vector)="<<item<<" on path="<<GetResolvedPath (""));
36.27 - ObjectVector vector = root->GetAttribute (item);
36.28 + ObjectVectorValue vector;
36.29 + root->GetAttribute (item, vector);
36.30 m_workStack.push_back (item);
36.31 DoArrayResolve (pathLeft, vector);
36.32 m_workStack.pop_back ();
36.33 @@ -246,7 +249,7 @@
36.34 }
36.35
36.36 void
36.37 -Resolver::DoArrayResolve (std::string path, const ObjectVector &vector)
36.38 +Resolver::DoArrayResolve (std::string path, const ObjectVectorValue &vector)
36.39 {
36.40 NS_ASSERT (path != "");
36.41 std::string::size_type pos = path.find ("/");
36.42 @@ -282,7 +285,7 @@
36.43 class ConfigImpl
36.44 {
36.45 public:
36.46 - void Set (std::string path, Attribute value);
36.47 + void Set (std::string path, const AttributeValue &value);
36.48 void ConnectWithoutContext (std::string path, const CallbackBase &cb);
36.49 void Connect (std::string path, const CallbackBase &cb);
36.50 void DisconnectWithoutContext (std::string path, const CallbackBase &cb);
36.51 @@ -300,19 +303,19 @@
36.52 };
36.53
36.54 void
36.55 -ConfigImpl::Set (std::string path, Attribute value)
36.56 +ConfigImpl::Set (std::string path, const AttributeValue &value)
36.57 {
36.58 class SetResolver : public Resolver
36.59 {
36.60 public:
36.61 - SetResolver (std::string path, Attribute value)
36.62 + SetResolver (std::string path, const AttributeValue &value)
36.63 : Resolver (path),
36.64 - m_value (value) {}
36.65 + m_value (value.Copy ()) {}
36.66 private:
36.67 virtual void DoOne (Ptr<Object> object, std::string path, std::string name) {
36.68 - object->SetAttribute (name, m_value);
36.69 + object->SetAttribute (name, *m_value);
36.70 }
36.71 - Attribute m_value;
36.72 + Ptr<const AttributeValue> m_value;
36.73 } resolver = SetResolver (path, value);
36.74 for (Roots::const_iterator i = m_roots.begin (); i != m_roots.end (); i++)
36.75 {
36.76 @@ -431,23 +434,23 @@
36.77
36.78 namespace Config {
36.79
36.80 -void Set (std::string path, Attribute value)
36.81 +void Set (std::string path, const AttributeValue &value)
36.82 {
36.83 Singleton<ConfigImpl>::Get ()->Set (path, value);
36.84 }
36.85 -void SetDefault (std::string name, Attribute value)
36.86 +void SetDefault (std::string name, const AttributeValue &value)
36.87 {
36.88 AttributeList::GetGlobal ()->Set (name, value);
36.89 }
36.90 -bool SetDefaultFailSafe (std::string name, Attribute value)
36.91 +bool SetDefaultFailSafe (std::string name, const AttributeValue &value)
36.92 {
36.93 return AttributeList::GetGlobal ()->SetFailSafe (name, value);
36.94 }
36.95 -void SetGlobal (std::string name, Attribute value)
36.96 +void SetGlobal (std::string name, const AttributeValue &value)
36.97 {
36.98 GlobalValue::Bind (name, value);
36.99 }
36.100 -bool SetGlobalFailSafe (std::string name, Attribute value)
36.101 +bool SetGlobalFailSafe (std::string name, const AttributeValue &value)
36.102 {
36.103 return GlobalValue::BindFailSafe (name, value);
36.104 }
36.105 @@ -534,31 +537,31 @@
36.106 static TypeId tid = TypeId ("MyNode")
36.107 .SetParent<Object> ()
36.108 .AddAttribute ("NodesA", "",
36.109 - ObjectVector (),
36.110 + ObjectVectorValue (),
36.111 MakeObjectVectorAccessor (&MyNode::m_nodesA),
36.112 MakeObjectVectorChecker<MyNode> ())
36.113 .AddAttribute ("NodesB", "",
36.114 - ObjectVector (),
36.115 + ObjectVectorValue (),
36.116 MakeObjectVectorAccessor (&MyNode::m_nodesB),
36.117 MakeObjectVectorChecker<MyNode> ())
36.118 .AddAttribute ("NodeA", "",
36.119 - Pointer (),
36.120 + PointerValue (),
36.121 MakePointerAccessor (&MyNode::m_nodeA),
36.122 MakePointerChecker<MyNode> ())
36.123 .AddAttribute ("NodeB", "",
36.124 - Pointer (),
36.125 + PointerValue (),
36.126 MakePointerAccessor (&MyNode::m_nodeB),
36.127 MakePointerChecker<MyNode> ())
36.128 .AddAttribute ("A", "",
36.129 - Integer (10),
36.130 + IntegerValue (10),
36.131 MakeIntegerAccessor (&MyNode::m_a),
36.132 MakeIntegerChecker<int8_t> ())
36.133 .AddAttribute ("B", "",
36.134 - Integer (9),
36.135 + IntegerValue (9),
36.136 MakeIntegerAccessor (&MyNode::m_b),
36.137 MakeIntegerChecker<int8_t> ())
36.138 .AddAttribute ("Source", "XX",
36.139 - Integer (-1),
36.140 + IntegerValue (-1),
36.141 MakeIntegerAccessor (&MyNode::m_trace),
36.142 MakeIntegerChecker<int16_t> ())
36.143 .AddTraceSource ("Source", "XX",
36.144 @@ -637,44 +640,45 @@
36.145
36.146 Ptr<MyNode> root = CreateObject<MyNode> ();
36.147 Config::RegisterRootNamespaceObject (root);
36.148 - Config::Set ("/A", Integer (1));
36.149 - Config::Set ("/B", Integer (-1));
36.150 - Integer v = root->GetAttribute ("A");
36.151 + Config::Set ("/A", IntegerValue (1));
36.152 + Config::Set ("/B", IntegerValue (-1));
36.153 + IntegerValue v;
36.154 + root->GetAttribute ("A", v);
36.155 NS_TEST_ASSERT_EQUAL (v.Get (), 1);
36.156 - v = root->GetAttribute ("B");
36.157 + root->GetAttribute ("B", v);
36.158 NS_TEST_ASSERT_EQUAL (v.Get (), -1);
36.159
36.160 Ptr<MyNode> a = CreateObject<MyNode> ();
36.161 root->SetNodeA (a);
36.162 - Config::Set ("/NodeA/A", Integer (2));
36.163 - Config::Set ("/NodeA/B", Integer (-2));
36.164 - v = a->GetAttribute ("A");
36.165 + Config::Set ("/NodeA/A", IntegerValue (2));
36.166 + Config::Set ("/NodeA/B", IntegerValue (-2));
36.167 + a->GetAttribute ("A", v);
36.168 NS_TEST_ASSERT_EQUAL (v.Get (), 2);
36.169 - v = a->GetAttribute ("B");
36.170 + a->GetAttribute ("B", v);
36.171 NS_TEST_ASSERT_EQUAL (v.Get (), -2);
36.172 - Config::Set ("/NodeB/A", Integer (3));
36.173 - Config::Set ("/NodeB/B", Integer (-3));
36.174 - v = a->GetAttribute ("A");
36.175 + Config::Set ("/NodeB/A", IntegerValue (3));
36.176 + Config::Set ("/NodeB/B", IntegerValue (-3));
36.177 + a->GetAttribute ("A", v);
36.178 NS_TEST_ASSERT_EQUAL (v.Get (), 2);
36.179 - v = a->GetAttribute ("B");
36.180 + a->GetAttribute ("B", v);
36.181 NS_TEST_ASSERT_EQUAL (v.Get (), -2);
36.182
36.183 Ptr<MyNode> b = CreateObject<MyNode> ();
36.184 a->SetNodeB (b);
36.185 - Config::Set ("/NodeA/NodeB/A", Integer (4));
36.186 - Config::Set ("/NodeA/NodeB/B", Integer (-4));
36.187 - v = b->GetAttribute ("A");
36.188 + Config::Set ("/NodeA/NodeB/A", IntegerValue (4));
36.189 + Config::Set ("/NodeA/NodeB/B", IntegerValue (-4));
36.190 + b->GetAttribute ("A", v);
36.191 NS_TEST_ASSERT_EQUAL (v.Get (), 4);
36.192 - v = b->GetAttribute ("B");
36.193 + b->GetAttribute ("B", v);
36.194 NS_TEST_ASSERT_EQUAL (v.Get (), -4);
36.195
36.196 Ptr<MyNode> c = CreateObject<MyNode> ();
36.197 root->SetNodeB (c);
36.198 - Config::Set ("/NodeB/A", Integer (5));
36.199 - Config::Set ("/NodeB/B", Integer (-5));
36.200 - v = c->GetAttribute ("A");
36.201 + Config::Set ("/NodeB/A", IntegerValue (5));
36.202 + Config::Set ("/NodeB/B", IntegerValue (-5));
36.203 + c->GetAttribute ("A", v);
36.204 NS_TEST_ASSERT_EQUAL (v.Get (), 5);
36.205 - v = c->GetAttribute ("B");
36.206 + c->GetAttribute ("B", v);
36.207 NS_TEST_ASSERT_EQUAL (v.Get (), -5);
36.208
36.209
36.210 @@ -686,49 +690,49 @@
36.211 b->AddNodeB (d1);
36.212 b->AddNodeB (d2);
36.213 b->AddNodeB (d3);
36.214 - Config::Set ("/NodeA/NodeB/NodesB/0/A", Integer (-11));
36.215 - v = d0->GetAttribute ("A");
36.216 + Config::Set ("/NodeA/NodeB/NodesB/0/A", IntegerValue (-11));
36.217 + d0->GetAttribute ("A", v);
36.218 NS_TEST_ASSERT_EQUAL (v.Get (), -11);
36.219 - v = d0->GetAttribute ("B");
36.220 + d0->GetAttribute ("B", v);
36.221 NS_TEST_ASSERT_EQUAL (v.Get (), 9);
36.222 - v = d1->GetAttribute ("A");
36.223 + d1->GetAttribute ("A", v);
36.224 NS_TEST_ASSERT_EQUAL (v.Get (), 10);
36.225 - v = d1->GetAttribute ("B");
36.226 + d1->GetAttribute ("B", v);
36.227 NS_TEST_ASSERT_EQUAL (v.Get (), 9);
36.228 - Config::Set ("/NodeA/NodeB/NodesB/0|1/A", Integer (-12));
36.229 - v = d0->GetAttribute ("A");
36.230 + Config::Set ("/NodeA/NodeB/NodesB/0|1/A", IntegerValue (-12));
36.231 + d0->GetAttribute ("A", v);
36.232 NS_TEST_ASSERT_EQUAL (v.Get (), -12);
36.233 - v = d1->GetAttribute ("A");
36.234 + d1->GetAttribute ("A", v);
36.235 NS_TEST_ASSERT_EQUAL (v.Get (), -12);
36.236 - Config::Set ("/NodeA/NodeB/NodesB/|0|1|/A", Integer (-13));
36.237 - v = d0->GetAttribute ("A");
36.238 + Config::Set ("/NodeA/NodeB/NodesB/|0|1|/A", IntegerValue (-13));
36.239 + d0->GetAttribute ("A", v);
36.240 NS_TEST_ASSERT_EQUAL (v.Get (), -13);
36.241 - v = d1->GetAttribute ("A");
36.242 + d1->GetAttribute ("A", v);
36.243 NS_TEST_ASSERT_EQUAL (v.Get (), -13);
36.244 - Config::Set ("/NodeA/NodeB/NodesB/[0-2]/A", Integer (-14));
36.245 - v = d0->GetAttribute ("A");
36.246 + Config::Set ("/NodeA/NodeB/NodesB/[0-2]/A", IntegerValue (-14));
36.247 + d0->GetAttribute ("A", v);
36.248 NS_TEST_ASSERT_EQUAL (v.Get (), -14);
36.249 - v = d1->GetAttribute ("A");
36.250 + d1->GetAttribute ("A", v);
36.251 NS_TEST_ASSERT_EQUAL (v.Get (), -14);
36.252 - v = d2->GetAttribute ("A");
36.253 + d2->GetAttribute ("A", v);
36.254 NS_TEST_ASSERT_EQUAL (v.Get (), -14);
36.255 - Config::Set ("/NodeA/NodeB/NodesB/[1-3]/A", Integer (-15));
36.256 - v = d0->GetAttribute ("A");
36.257 + Config::Set ("/NodeA/NodeB/NodesB/[1-3]/A", IntegerValue (-15));
36.258 + d0->GetAttribute ("A", v);
36.259 NS_TEST_ASSERT_EQUAL (v.Get (), -14);
36.260 - v = d1->GetAttribute ("A");
36.261 + d1->GetAttribute ("A", v);
36.262 NS_TEST_ASSERT_EQUAL (v.Get (), -15);
36.263 - v = d2->GetAttribute ("A");
36.264 + d2->GetAttribute ("A", v);
36.265 NS_TEST_ASSERT_EQUAL (v.Get (), -15);
36.266 - v = d3->GetAttribute ("A");
36.267 + d3->GetAttribute ("A", v);
36.268 NS_TEST_ASSERT_EQUAL (v.Get (), -15);
36.269 - Config::Set ("/NodeA/NodeB/NodesB/[0-1]|3/A", Integer (-16));
36.270 - v = d0->GetAttribute ("A");
36.271 + Config::Set ("/NodeA/NodeB/NodesB/[0-1]|3/A", IntegerValue (-16));
36.272 + d0->GetAttribute ("A", v);
36.273 NS_TEST_ASSERT_EQUAL (v.Get (), -16);
36.274 - v = d1->GetAttribute ("A");
36.275 + d1->GetAttribute ("A", v);
36.276 NS_TEST_ASSERT_EQUAL (v.Get (), -16);
36.277 - v = d2->GetAttribute ("A");
36.278 + d2->GetAttribute ("A", v);
36.279 NS_TEST_ASSERT_EQUAL (v.Get (), -15);
36.280 - v = d3->GetAttribute ("A");
36.281 + d3->GetAttribute ("A", v);
36.282 NS_TEST_ASSERT_EQUAL (v.Get (), -16);
36.283
36.284
36.285 @@ -736,17 +740,17 @@
36.286 MakeCallback (&ConfigTest::ChangeNotification, this));
36.287 m_traceNotification = 0;
36.288 // this should trigger no notification
36.289 - d2->SetAttribute ("Source", Integer (-2));
36.290 + d2->SetAttribute ("Source", IntegerValue (-2));
36.291 NS_TEST_ASSERT_EQUAL (m_traceNotification, 0);
36.292 m_traceNotification = 0;
36.293 // this should trigger a notification
36.294 - d1->SetAttribute ("Source", Integer (-3));
36.295 + d1->SetAttribute ("Source", IntegerValue (-3));
36.296 NS_TEST_ASSERT_EQUAL (m_traceNotification, -3);
36.297 Config::DisconnectWithoutContext ("/NodeA/NodeB/NodesB/[0-1]|3/Source",
36.298 MakeCallback (&ConfigTest::ChangeNotification, this));
36.299 m_traceNotification = 0;
36.300 // this should _not_ trigger a notification
36.301 - d1->SetAttribute ("Source", Integer (-4));
36.302 + d1->SetAttribute ("Source", IntegerValue (-4));
36.303 NS_TEST_ASSERT_EQUAL (m_traceNotification, 0);
36.304
36.305
36.306 @@ -754,25 +758,25 @@
36.307 MakeCallback (&ConfigTest::ChangeNotificationWithPath, this));
36.308 m_traceNotification = 0;
36.309 // this should trigger no notification
36.310 - d2->SetAttribute ("Source", Integer (-2));
36.311 + d2->SetAttribute ("Source", IntegerValue (-2));
36.312 NS_TEST_ASSERT_EQUAL (m_traceNotification, 0);
36.313 m_traceNotification = 0;
36.314 m_tracePath = "";
36.315 // this should trigger a notification
36.316 - d1->SetAttribute ("Source", Integer (-3));
36.317 + d1->SetAttribute ("Source", IntegerValue (-3));
36.318 NS_TEST_ASSERT_EQUAL (m_traceNotification, -3);
36.319 NS_TEST_ASSERT_EQUAL (m_tracePath, "/NodeA/NodeB/NodesB/1/Source")
36.320 m_traceNotification = 0;
36.321 m_tracePath = "";
36.322 // this should trigger a notification
36.323 - d3->SetAttribute ("Source", Integer (-3));
36.324 + d3->SetAttribute ("Source", IntegerValue (-3));
36.325 NS_TEST_ASSERT_EQUAL (m_traceNotification, -3);
36.326 NS_TEST_ASSERT_EQUAL (m_tracePath, "/NodeA/NodeB/NodesB/3/Source");
36.327 Config::Disconnect ("/NodeA/NodeB/NodesB/[0-1]|3/Source",
36.328 MakeCallback (&ConfigTest::ChangeNotificationWithPath, this));
36.329 m_traceNotification = 0;
36.330 // this should _not_ trigger a notification
36.331 - d1->SetAttribute ("Source", Integer (-4));
36.332 + d1->SetAttribute ("Source", IntegerValue (-4));
36.333 NS_TEST_ASSERT_EQUAL (m_traceNotification, 0);
36.334
36.335
37.1 --- a/src/core/config.h Mon Apr 14 16:19:17 2008 -0700
37.2 +++ b/src/core/config.h Thu Apr 17 13:42:25 2008 -0700
37.3 @@ -20,13 +20,15 @@
37.4 #ifndef CONFIG_H
37.5 #define CONFIG_H
37.6
37.7 -#include "attribute.h"
37.8 #include "ptr.h"
37.9 -#include "object.h"
37.10 #include <string>
37.11
37.12 namespace ns3 {
37.13
37.14 +class AttributeValue;
37.15 +class Object;
37.16 +class CallbackBase;
37.17 +
37.18 namespace Config {
37.19
37.20 /**
37.21 @@ -37,7 +39,7 @@
37.22 * match the input path and will then set their value to the input
37.23 * value.
37.24 */
37.25 -void Set (std::string path, Attribute value);
37.26 +void Set (std::string path, const AttributeValue &value);
37.27 /**
37.28 * \param name the full name of the attribute
37.29 * \param value the value to set.
37.30 @@ -46,7 +48,7 @@
37.31 * matching attribute. This method cannot fail: it will
37.32 * crash if the input attribute name or value is invalid.
37.33 */
37.34 -void SetDefault (std::string name, Attribute value);
37.35 +void SetDefault (std::string name, const AttributeValue &value);
37.36 /**
37.37 * \param name the full name of the attribute
37.38 * \param value the value to set.
37.39 @@ -55,21 +57,21 @@
37.40 * This method overrides the initial value of the
37.41 * matching attribute.
37.42 */
37.43 -bool SetDefaultFailSafe (std::string name, Attribute value);
37.44 +bool SetDefaultFailSafe (std::string name, const AttributeValue &value);
37.45 /**
37.46 * \param name the name of the requested GlobalValue.
37.47 * \param value the value to set
37.48 *
37.49 * This method is equivalent to GlobalValue::Bind
37.50 */
37.51 -void SetGlobal (std::string name, Attribute value);
37.52 +void SetGlobal (std::string name, const AttributeValue &value);
37.53 /**
37.54 * \param name the name of the requested GlobalValue.
37.55 * \param value the value to set
37.56 *
37.57 * This method is equivalent to GlobalValue::BindFailSafe
37.58 */
37.59 -bool SetGlobalFailSafe (std::string name, Attribute value);
37.60 +bool SetGlobalFailSafe (std::string name, const AttributeValue &value);
37.61 /**
37.62 * \param path a path to match trace sources.
37.63 * \param cb the callback to connect to the matching trace sources.
38.1 --- a/src/core/double.cc Mon Apr 14 16:19:17 2008 -0700
38.2 +++ b/src/core/double.cc Thu Apr 17 13:42:25 2008 -0700
38.3 @@ -23,40 +23,7 @@
38.4
38.5 namespace ns3 {
38.6
38.7 -Double::Double ()
38.8 -{}
38.9 -Double::Double (double value)
38.10 - : m_value (value)
38.11 -{}
38.12 -void
38.13 -Double::Set (double value)
38.14 -{
38.15 - m_value = value;
38.16 -}
38.17 -double
38.18 -Double::Get (void) const
38.19 -{
38.20 - return m_value;
38.21 -}
38.22 -Double::operator double () const
38.23 -{
38.24 - return m_value;
38.25 -}
38.26 -std::ostream & operator << (std::ostream &os, const Double &value)
38.27 -{
38.28 - os << value.Get ();
38.29 - return os;
38.30 -}
38.31 -std::istream & operator >> (std::istream &is, Double &value)
38.32 -{
38.33 - double v;
38.34 - is >> v;
38.35 - value.Set (v);
38.36 - return is;
38.37 -}
38.38 -
38.39 -ATTRIBUTE_VALUE_IMPLEMENT (Double);
38.40 -ATTRIBUTE_CONVERTER_IMPLEMENT (Double);
38.41 +ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME (double, Double);
38.42
38.43 namespace internal {
38.44
38.45 @@ -68,8 +35,8 @@
38.46 : m_minValue (minValue),
38.47 m_maxValue (maxValue),
38.48 m_name (name) {}
38.49 - virtual bool Check (Attribute value) const {
38.50 - const DoubleValue *v = value.DynCast<const DoubleValue *> ();
38.51 + virtual bool Check (const AttributeValue &value) const {
38.52 + const DoubleValue *v = dynamic_cast<const DoubleValue *> (&value);
38.53 if (v == 0)
38.54 {
38.55 return false;
38.56 @@ -87,8 +54,18 @@
38.57 oss << m_minValue << ":" << m_maxValue;
38.58 return oss.str ();
38.59 }
38.60 - virtual Attribute Create (void) const {
38.61 - return Attribute (ns3::Create<DoubleValue> ());
38.62 + virtual Ptr<AttributeValue> Create (void) const {
38.63 + return ns3::Create<DoubleValue> ();
38.64 + }
38.65 + virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const {
38.66 + const DoubleValue *src = dynamic_cast<const DoubleValue *> (&source);
38.67 + DoubleValue *dst = dynamic_cast<DoubleValue *> (&destination);
38.68 + if (src == 0 || dst == 0)
38.69 + {
38.70 + return false;
38.71 + }
38.72 + *dst = *src;
38.73 + return true;
38.74 }
38.75 double m_minValue;
38.76 double m_maxValue;
39.1 --- a/src/core/double.h Mon Apr 14 16:19:17 2008 -0700
39.2 +++ b/src/core/double.h Thu Apr 17 13:42:25 2008 -0700
39.3 @@ -33,26 +33,8 @@
39.4 * This class can be used to hold variables of floating point type
39.5 * such as 'double' or 'float'. The internal format is 'double'.
39.6 */
39.7 -class Double
39.8 -{
39.9 -public:
39.10 - Double ();
39.11 - Double (double value);
39.12
39.13 - void Set (double value);
39.14 - double Get (void) const;
39.15 -
39.16 - operator double () const;
39.17 -
39.18 - ATTRIBUTE_CONVERTER_DEFINE (Double);
39.19 -private:
39.20 - double m_value;
39.21 -};
39.22 -
39.23 -std::ostream & operator << (std::ostream &os, const Double &value);
39.24 -std::istream & operator >> (std::istream &is, Double &value);
39.25 -
39.26 -ATTRIBUTE_VALUE_DEFINE (Double);
39.27 +ATTRIBUTE_VALUE_DEFINE_WITH_NAME (double, Double);
39.28 ATTRIBUTE_ACCESSOR_DEFINE (Double);
39.29
39.30 template <typename T>
40.1 --- a/src/core/enum.cc Mon Apr 14 16:19:17 2008 -0700
40.2 +++ b/src/core/enum.cc Thu Apr 17 13:42:25 2008 -0700
40.3 @@ -23,30 +23,30 @@
40.4
40.5 namespace ns3 {
40.6
40.7 -Enum::Enum ()
40.8 +EnumValue::EnumValue ()
40.9 : m_v ()
40.10 {}
40.11 -Enum::Enum (int v)
40.12 +EnumValue::EnumValue (int v)
40.13 : m_v (v)
40.14 {}
40.15 void
40.16 -Enum::Set (int v)
40.17 +EnumValue::Set (int v)
40.18 {
40.19 m_v = v;
40.20 }
40.21 int
40.22 -Enum::Get (void) const
40.23 +EnumValue::Get (void) const
40.24 {
40.25 return m_v;
40.26 }
40.27
40.28 -Attribute
40.29 -Enum::Copy (void) const
40.30 +Ptr<AttributeValue>
40.31 +EnumValue::Copy (void) const
40.32 {
40.33 - return Attribute (ns3::Create<Enum> (*this));
40.34 + return ns3::Create<EnumValue> (*this);
40.35 }
40.36 std::string
40.37 -Enum::SerializeToString (Ptr<const AttributeChecker> checker) const
40.38 +EnumValue::SerializeToString (Ptr<const AttributeChecker> checker) const
40.39 {
40.40 const EnumChecker *p = dynamic_cast<const EnumChecker *> (PeekPointer (checker));
40.41 NS_ASSERT (p != 0);
40.42 @@ -63,7 +63,7 @@
40.43 return "";
40.44 }
40.45 bool
40.46 -Enum::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
40.47 +EnumValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
40.48 {
40.49 const EnumChecker *p = dynamic_cast<const EnumChecker *> (PeekPointer (checker));
40.50 NS_ASSERT (p != 0);
40.51 @@ -78,22 +78,6 @@
40.52 return false;
40.53 }
40.54
40.55 -Enum::Enum (Attribute value)
40.56 -{
40.57 - const Enum *v = value.DynCast<const Enum *> ();
40.58 - if (v == 0)
40.59 - {
40.60 - NS_FATAL_ERROR ("assigning non-Enum value to Enum value.");
40.61 - }
40.62 - m_v = v->m_v;
40.63 -}
40.64 -Enum::operator Attribute () const
40.65 -{
40.66 - return Attribute (ns3::Create<Enum> (*this));
40.67 -}
40.68 -
40.69 -
40.70 -
40.71 EnumChecker::EnumChecker ()
40.72 {}
40.73
40.74 @@ -108,9 +92,9 @@
40.75 m_valueSet.push_back (std::make_pair (v, name));
40.76 }
40.77 bool
40.78 -EnumChecker::Check (Attribute value) const
40.79 +EnumChecker::Check (const AttributeValue &value) const
40.80 {
40.81 - const Enum *p = value.DynCast<const Enum *> ();
40.82 + const EnumValue *p = dynamic_cast<const EnumValue *> (&value);
40.83 if (p == 0)
40.84 {
40.85 return false;
40.86 @@ -149,10 +133,23 @@
40.87 }
40.88 return oss.str ();
40.89 }
40.90 -Attribute
40.91 +Ptr<AttributeValue>
40.92 EnumChecker::Create (void) const
40.93 {
40.94 - return Attribute (ns3::Create<Enum> ());
40.95 + return ns3::Create<EnumValue> ();
40.96 +}
40.97 +
40.98 +bool
40.99 +EnumChecker::Copy (const AttributeValue &source, AttributeValue &destination) const
40.100 +{
40.101 + const EnumValue *src = dynamic_cast<const EnumValue *> (&source);
40.102 + EnumValue *dst = dynamic_cast<EnumValue *> (&destination);
40.103 + if (src == 0 || dst == 0)
40.104 + {
40.105 + return false;
40.106 + }
40.107 + *dst = *src;
40.108 + return true;
40.109 }
40.110
40.111
41.1 --- a/src/core/enum.h Mon Apr 14 16:19:17 2008 -0700
41.2 +++ b/src/core/enum.h Thu Apr 17 13:42:25 2008 -0700
41.3 @@ -32,20 +32,18 @@
41.4 * This class can be used to hold variables of any kind
41.5 * of enum.
41.6 */
41.7 -class Enum : public AttributeValue
41.8 +class EnumValue : public AttributeValue
41.9 {
41.10 public:
41.11 - Enum ();
41.12 - Enum (int v);
41.13 + EnumValue ();
41.14 + EnumValue (int v);
41.15 void Set (int v);
41.16 int Get (void) const;
41.17
41.18 - virtual Attribute Copy (void) const;
41.19 + virtual Ptr<AttributeValue> Copy (void) const;
41.20 virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
41.21 virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
41.22
41.23 - Enum (Attribute value);
41.24 - operator Attribute () const;
41.25 private:
41.26 int m_v;
41.27 };
41.28 @@ -58,14 +56,15 @@
41.29 void AddDefault (int v, std::string name);
41.30 void Add (int v, std::string name);
41.31
41.32 - virtual bool Check (Attribute value) const;
41.33 + virtual bool Check (const AttributeValue &value) const;
41.34 virtual std::string GetType (void) const;
41.35 virtual bool HasTypeConstraints (void) const;
41.36 virtual std::string GetTypeConstraints (void) const;
41.37 - virtual Attribute Create (void) const;
41.38 + virtual Ptr<AttributeValue> Create (void) const;
41.39 + virtual bool Copy (const AttributeValue &src, AttributeValue &dst) const;
41.40
41.41 private:
41.42 - friend class Enum;
41.43 + friend class EnumValue;
41.44 typedef std::list<std::pair<int,std::string> > ValueSet;
41.45 ValueSet m_valueSet;
41.46 };
41.47 @@ -97,13 +96,13 @@
41.48 template <typename T1>
41.49 Ptr<const AttributeAccessor> MakeEnumAccessor (T1 a1)
41.50 {
41.51 - return MakeAccessorHelper<Enum> (a1);
41.52 + return MakeAccessorHelper<EnumValue> (a1);
41.53 }
41.54
41.55 template <typename T1, typename T2>
41.56 Ptr<const AttributeAccessor> MakeEnumAccessor (T1 a1, T2 a2)
41.57 {
41.58 - return MakeAccessorHelper<Enum> (a1, a2);
41.59 + return MakeAccessorHelper<EnumValue> (a1, a2);
41.60 }
41.61
41.62 } // namespace ns3
42.1 --- a/src/core/global-value.cc Mon Apr 14 16:19:17 2008 -0700
42.2 +++ b/src/core/global-value.cc Thu Apr 17 13:42:25 2008 -0700
42.3 @@ -25,11 +25,11 @@
42.4 namespace ns3 {
42.5
42.6 GlobalValue::GlobalValue (std::string name, std::string help,
42.7 - Attribute initialValue,
42.8 + const AttributeValue &initialValue,
42.9 Ptr<const AttributeChecker> checker)
42.10 : m_name (name),
42.11 m_help (help),
42.12 - m_initialValue (initialValue),
42.13 + m_initialValue (initialValue.Copy ()),
42.14 m_checker (checker)
42.15 {
42.16 if (m_checker == 0)
42.17 @@ -49,10 +49,20 @@
42.18 {
42.19 return m_help;
42.20 }
42.21 -Attribute
42.22 -GlobalValue::GetValue (void) const
42.23 +void
42.24 +GlobalValue::GetValue (AttributeValue &value) const
42.25 {
42.26 - return m_initialValue;
42.27 + bool ok = m_checker->Copy (*m_initialValue, value);
42.28 + if (ok)
42.29 + {
42.30 + return;
42.31 + }
42.32 + StringValue *str = dynamic_cast<StringValue *> (&value);
42.33 + if (str == 0)
42.34 + {
42.35 + NS_FATAL_ERROR ("GlobalValue name="<<m_name<<": input value is not a string");
42.36 + }
42.37 + str->Set (m_initialValue->SerializeToString (m_checker));
42.38 }
42.39 Ptr<const AttributeChecker>
42.40 GlobalValue::GetChecker (void) const
42.41 @@ -61,37 +71,37 @@
42.42 }
42.43
42.44 bool
42.45 -GlobalValue::SetValue (Attribute value)
42.46 +GlobalValue::SetValue (const AttributeValue &value)
42.47 {
42.48 if (m_checker->Check (value))
42.49 {
42.50 - m_initialValue = value;
42.51 + m_initialValue = value.Copy ();
42.52 return true;
42.53 }
42.54 // attempt to convert to string.
42.55 - const StringValue *str = value.DynCast<const StringValue *> ();
42.56 + const StringValue *str = dynamic_cast<const StringValue *> (&value);
42.57 if (str == 0)
42.58 {
42.59 return false;
42.60 }
42.61 // attempt to convert back to value.
42.62 - Attribute v = m_checker->Create ();
42.63 - bool ok = v.DeserializeFromString (str->Get ().Get (), m_checker);
42.64 + Ptr<AttributeValue> v = m_checker->Create ();
42.65 + bool ok = v->DeserializeFromString (str->Get (), m_checker);
42.66 if (!ok)
42.67 {
42.68 return false;
42.69 }
42.70 - ok = m_checker->Check (v);
42.71 + ok = m_checker->Check (*v);
42.72 if (!ok)
42.73 {
42.74 return false;
42.75 }
42.76 - m_initialValue = v;
42.77 + m_checker->Copy (*v, *PeekPointer (m_initialValue));
42.78 return true;
42.79 }
42.80
42.81 void
42.82 -GlobalValue::Bind (std::string name, Attribute value)
42.83 +GlobalValue::Bind (std::string name, const AttributeValue &value)
42.84 {
42.85 for (Iterator i = Begin (); i != End (); i++)
42.86 {
42.87 @@ -107,7 +117,7 @@
42.88 NS_FATAL_ERROR ("Non-existant global value: "<<name);
42.89 }
42.90 bool
42.91 -GlobalValue::BindFailSafe (std::string name, Attribute value)
42.92 +GlobalValue::BindFailSafe (std::string name, const AttributeValue &value)
42.93 {
42.94 for (Iterator i = Begin (); i != End (); i++)
42.95 {
42.96 @@ -160,11 +170,13 @@
42.97 {
42.98 bool result = true;
42.99 GlobalValue uint = GlobalValue ("TestUint", "help text",
42.100 - Uinteger (10),
42.101 + UintegerValue (10),
42.102 MakeUintegerChecker<uint32_t> ());
42.103
42.104
42.105 - NS_TEST_ASSERT_EQUAL (10, Uinteger (uint.GetValue ()).Get ());
42.106 + UintegerValue v;
42.107 + uint.GetValue (v);
42.108 + NS_TEST_ASSERT_EQUAL (10, v.Get ());
42.109
42.110 GlobalValue::Vector *vector = GlobalValue::GetVector ();
42.111 for (GlobalValue::Vector::iterator i = vector->begin (); i != vector->end (); ++i)
43.1 --- a/src/core/global-value.h Mon Apr 14 16:19:17 2008 -0700
43.2 +++ b/src/core/global-value.h Thu Apr 17 13:42:25 2008 -0700
43.3 @@ -51,8 +51,8 @@
43.4 * value matches the requested type constraints.
43.5 */
43.6 GlobalValue (std::string name, std::string help,
43.7 - Attribute initialValue,
43.8 - Ptr<const AttributeChecker> checker);
43.9 + const AttributeValue &initialValue,
43.10 + Ptr<const AttributeChecker> checker);
43.11
43.12 /**
43.13 * \returns the name of this GlobalValue.
43.14 @@ -65,7 +65,7 @@
43.15 /**
43.16 * \returns the current value of this GlobalValue.
43.17 */
43.18 - Attribute GetValue (void) const;
43.19 + void GetValue (AttributeValue &value) const;
43.20 /**
43.21 * \returns the checker associated to this GlobalValue.
43.22 */
43.23 @@ -73,7 +73,7 @@
43.24 /**
43.25 * \param value the new value to set in this GlobalValue.
43.26 */
43.27 - bool SetValue (Attribute value);
43.28 + bool SetValue (const AttributeValue &value);
43.29
43.30 /**
43.31 * \param name the name of the global value
43.32 @@ -84,7 +84,7 @@
43.33 *
43.34 * This method cannot fail. It will crash if the input is not valid.
43.35 */
43.36 - static void Bind (std::string name, Attribute value);
43.37 + static void Bind (std::string name, const AttributeValue &value);
43.38
43.39 /**
43.40 * \param name the name of the global value
43.41 @@ -94,7 +94,7 @@
43.42 * Iterate over the set of GlobalValues until a matching name is found
43.43 * and then set its value with GlobalValue::SetValue.
43.44 */
43.45 - static bool BindFailSafe (std::string name, Attribute value);
43.46 + static bool BindFailSafe (std::string name, const AttributeValue &value);
43.47
43.48 /**
43.49 * \returns an iterator which represents a pointer to the first GlobalValue registered.
43.50 @@ -109,7 +109,7 @@
43.51 static Vector *GetVector (void);
43.52 std::string m_name;
43.53 std::string m_help;
43.54 - Attribute m_initialValue;
43.55 + Ptr<AttributeValue> m_initialValue;
43.56 Ptr<const AttributeChecker> m_checker;
43.57 };
43.58
44.1 --- a/src/core/integer.cc Mon Apr 14 16:19:17 2008 -0700
44.2 +++ b/src/core/integer.cc Thu Apr 17 13:42:25 2008 -0700
44.3 @@ -23,44 +23,7 @@
44.4
44.5 namespace ns3 {
44.6
44.7 -Integer::Integer (int64_t value)
44.8 - : m_value (value)
44.9 -{}
44.10 -Integer::Integer ()
44.11 - : m_value (0)
44.12 -{}
44.13 -void
44.14 -Integer::Set (int64_t value)
44.15 -{
44.16 - m_value = value;
44.17 -}
44.18 -int64_t
44.19 -Integer::Get (void) const
44.20 -{
44.21 - return m_value;
44.22 -}
44.23 -
44.24 -Integer::operator int64_t () const
44.25 -{
44.26 - return m_value;
44.27 -}
44.28 -
44.29 -ATTRIBUTE_VALUE_IMPLEMENT (Integer);
44.30 -
44.31 -std::ostream &operator << (std::ostream &os, const Integer &integer)
44.32 -{
44.33 - os << integer.Get ();
44.34 - return os;
44.35 -}
44.36 -std::istream &operator >> (std::istream &is, Integer &integer)
44.37 -{
44.38 - int64_t v;
44.39 - is >> v;
44.40 - integer.Set (v);
44.41 - return is;
44.42 -}
44.43 -
44.44 -ATTRIBUTE_CONVERTER_IMPLEMENT (Integer);
44.45 +ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME (int64_t, Integer);
44.46
44.47 namespace internal {
44.48
44.49 @@ -73,13 +36,13 @@
44.50 : m_minValue (minValue),
44.51 m_maxValue (maxValue),
44.52 m_name (name) {}
44.53 - virtual bool Check (Attribute value) const {
44.54 - const IntegerValue *v = value.DynCast<const IntegerValue *> ();
44.55 + virtual bool Check (const AttributeValue &value) const {
44.56 + const IntegerValue *v = dynamic_cast<const IntegerValue *> (&value);
44.57 if (v == 0)
44.58 {
44.59 return false;
44.60 }
44.61 - return v->Get ().Get () >= m_minValue && v->Get ().Get() <= m_maxValue;
44.62 + return v->Get () >= m_minValue && v->Get () <= m_maxValue;
44.63 }
44.64 virtual std::string GetType (void) const {
44.65 return m_name;
44.66 @@ -92,8 +55,18 @@
44.67 oss << m_minValue << ":" << m_maxValue;
44.68 return oss.str ();
44.69 }
44.70 - virtual Attribute Create (void) const {
44.71 - return Attribute (ns3::Create<IntegerValue> ());
44.72 + virtual Ptr<AttributeValue> Create (void) const {
44.73 + return ns3::Create<IntegerValue> ();
44.74 + }
44.75 + virtual bool Copy (const AttributeValue &src, AttributeValue &dst) const {
44.76 + const IntegerValue *source = dynamic_cast<const IntegerValue *> (&src);
44.77 + IntegerValue *destination = dynamic_cast<IntegerValue *> (&dst);
44.78 + if (source == 0 || destination == 0)
44.79 + {
44.80 + return false;
44.81 + }
44.82 + *destination = *source;
44.83 + return true;
44.84 }
44.85 int64_t m_minValue;
44.86 int64_t m_maxValue;
45.1 --- a/src/core/integer.h Mon Apr 14 16:19:17 2008 -0700
45.2 +++ b/src/core/integer.h Thu Apr 17 13:42:25 2008 -0700
45.3 @@ -38,24 +38,8 @@
45.4 * type such as int8_t, int16_t, int32_t, int64_t, or,
45.5 * int, etc.
45.6 */
45.7 -class Integer
45.8 -{
45.9 -public:
45.10 - Integer (int64_t value);
45.11 - Integer ();
45.12 - void Set (int64_t value);
45.13 - int64_t Get (void) const;
45.14
45.15 - operator int64_t () const;
45.16 - ATTRIBUTE_CONVERTER_DEFINE (Integer);
45.17 -private:
45.18 - int64_t m_value;
45.19 -};
45.20 -
45.21 -std::ostream &operator << (std::ostream &os, const Integer &integer);
45.22 -std::istream &operator >> (std::istream &is, Integer &integer);
45.23 -
45.24 -ATTRIBUTE_VALUE_DEFINE(Integer);
45.25 +ATTRIBUTE_VALUE_DEFINE_WITH_NAME(int64_t, Integer);
45.26 ATTRIBUTE_ACCESSOR_DEFINE(Integer);
45.27
45.28 template <typename T>
46.1 --- a/src/core/object-base.cc Mon Apr 14 16:19:17 2008 -0700
46.2 +++ b/src/core/object-base.cc Thu Apr 17 13:42:25 2008 -0700
46.3 @@ -20,6 +20,7 @@
46.4 #include "object-base.h"
46.5 #include "log.h"
46.6 #include "trace-source-accessor.h"
46.7 +#include "attribute-list.h"
46.8 #include "string.h"
46.9
46.10 NS_LOG_COMPONENT_DEFINE ("ObjectBase");
46.11 @@ -58,8 +59,8 @@
46.12 NS_LOG_DEBUG ("construct tid="<<tid.GetName ()<<", params="<<tid.GetAttributeN ());
46.13 for (uint32_t i = 0; i < tid.GetAttributeN (); i++)
46.14 {
46.15 - Ptr<const AttributeAccessor> paramSpec = tid.GetAttributeAccessor (i);
46.16 - Attribute initial = tid.GetAttributeInitialValue (i);
46.17 + Ptr<const AttributeAccessor> accessor = tid.GetAttributeAccessor (i);
46.18 + Ptr<const AttributeValue> initial = tid.GetAttributeInitialValue (i);
46.19 Ptr<const AttributeChecker> checker = tid.GetAttributeChecker (i);
46.20 NS_LOG_DEBUG ("try to construct \""<< tid.GetName ()<<"::"<<
46.21 tid.GetAttributeName (i)<<"\"");
46.22 @@ -75,7 +76,7 @@
46.23 if (j->checker == checker)
46.24 {
46.25 // We have a matching attribute value.
46.26 - DoSet (paramSpec, initial, checker, j->value);
46.27 + DoSet (accessor, checker, *j->value);
46.28 NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
46.29 tid.GetAttributeName (i)<<"\"");
46.30 found = true;
46.31 @@ -91,7 +92,7 @@
46.32 if (j->checker == checker)
46.33 {
46.34 // We have a matching attribute value.
46.35 - DoSet (paramSpec, initial, checker, j->value);
46.36 + DoSet (accessor, checker, *j->value);
46.37 NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
46.38 tid.GetAttributeName (i)<<"\" from global");
46.39 found = true;
46.40 @@ -102,7 +103,7 @@
46.41 if (!found)
46.42 {
46.43 // No matching attribute value so we set the default value.
46.44 - paramSpec->Set (this, initial);
46.45 + DoSet (accessor, checker, *initial);
46.46 NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<<
46.47 tid.GetAttributeName (i)<<"\" from initial value.");
46.48 }
46.49 @@ -113,37 +114,39 @@
46.50 }
46.51
46.52 bool
46.53 -ObjectBase::DoSet (Ptr<const AttributeAccessor> spec, Attribute initialValue,
46.54 - Ptr<const AttributeChecker> checker, Attribute value)
46.55 +ObjectBase::DoSet (Ptr<const AttributeAccessor> spec,
46.56 + Ptr<const AttributeChecker> checker,
46.57 + const AttributeValue &value)
46.58 {
46.59 bool ok = checker->Check (value);
46.60 + if (ok)
46.61 + {
46.62 + ok = spec->Set (this, value);
46.63 + return ok;
46.64 + }
46.65 + // attempt to convert to string
46.66 + const StringValue *str = dynamic_cast<const StringValue *> (&value);
46.67 + if (str == 0)
46.68 + {
46.69 + return false;
46.70 + }
46.71 + // attempt to convert back from string.
46.72 + Ptr<AttributeValue> v = checker->Create ();
46.73 + ok = v->DeserializeFromString (str->Get (), checker);
46.74 if (!ok)
46.75 {
46.76 - // attempt to convert to string
46.77 - const StringValue *str = value.DynCast<const StringValue *> ();
46.78 - if (str == 0)
46.79 - {
46.80 - return false;
46.81 - }
46.82 - // attempt to convert back from string.
46.83 - Attribute v = checker->Create ();
46.84 - ok = v.DeserializeFromString (str->Get ().Get (), checker);
46.85 - if (!ok)
46.86 - {
46.87 - return false;
46.88 - }
46.89 - ok = checker->Check (v);
46.90 - if (!ok)
46.91 - {
46.92 - return false;
46.93 - }
46.94 - value = v;
46.95 + return false;
46.96 }
46.97 - ok = spec->Set (this, value);
46.98 + ok = checker->Check (*v);
46.99 + if (!ok)
46.100 + {
46.101 + return false;
46.102 + }
46.103 + ok = spec->Set (this, *v);
46.104 return ok;
46.105 }
46.106 void
46.107 -ObjectBase::SetAttribute (std::string name, Attribute value)
46.108 +ObjectBase::SetAttribute (std::string name, const AttributeValue &value)
46.109 {
46.110 struct TypeId::AttributeInfo info;
46.111 TypeId tid = GetInstanceTypeId ();
46.112 @@ -151,17 +154,18 @@
46.113 {
46.114 NS_FATAL_ERROR ("Attribute name="<<name<<" does not exist for this object: tid="<<tid.GetName ());
46.115 }
46.116 - if (!(info.flags & TypeId::ATTR_SET))
46.117 + if (!(info.flags & TypeId::ATTR_SET) ||
46.118 + !info.accessor->HasSetter ())
46.119 {
46.120 NS_FATAL_ERROR ("Attribute name="<<name<<" is not settable for this object: tid="<<tid.GetName ());
46.121 }
46.122 - if (!DoSet (info.accessor, info.initialValue, info.checker, value))
46.123 + if (!DoSet (info.accessor, info.checker, value))
46.124 {
46.125 NS_FATAL_ERROR ("Attribute name="<<name<<" could not be set for this object: tid="<<tid.GetName ());
46.126 }
46.127 }
46.128 bool
46.129 -ObjectBase::SetAttributeFailSafe (std::string name, Attribute value)
46.130 +ObjectBase::SetAttributeFailSafe (std::string name, const AttributeValue &value)
46.131 {
46.132 struct TypeId::AttributeInfo info;
46.133 TypeId tid = GetInstanceTypeId ();
46.134 @@ -169,14 +173,16 @@
46.135 {
46.136 return false;
46.137 }
46.138 - if (!(info.flags & TypeId::ATTR_SET))
46.139 + if (!(info.flags & TypeId::ATTR_SET) ||
46.140 + !info.accessor->HasSetter ())
46.141 {
46.142 return false;
46.143 }
46.144 - return DoSet (info.accessor, info.initialValue, info.checker, value);
46.145 + return DoSet (info.accessor, info.checker, value);
46.146 }
46.147 -std::string
46.148 -ObjectBase::GetAttributeAsString (std::string name) const
46.149 +
46.150 +void
46.151 +ObjectBase::GetAttribute (std::string name, AttributeValue &value) const
46.152 {
46.153 struct TypeId::AttributeInfo info;
46.154 TypeId tid = GetInstanceTypeId ();
46.155 @@ -184,44 +190,33 @@
46.156 {
46.157 NS_FATAL_ERROR ("Attribute name="<<name<<" does not exist for this object: tid="<<tid.GetName ());
46.158 }
46.159 - if (!(info.flags & TypeId::ATTR_GET))
46.160 + if (!(info.flags & TypeId::ATTR_GET) ||
46.161 + !info.accessor->HasGetter ())
46.162 {
46.163 NS_FATAL_ERROR ("Attribute name="<<name<<" is not gettable for this object: tid="<<tid.GetName ());
46.164 }
46.165 - Attribute v = info.checker->Create ();
46.166 - bool ok = info.accessor->Get (this, v);
46.167 + bool ok = info.accessor->Get (this, value);
46.168 + if (ok)
46.169 + {
46.170 + return;
46.171 + }
46.172 + StringValue *str = dynamic_cast<StringValue *> (&value);
46.173 + if (str == 0)
46.174 + {
46.175 + NS_FATAL_ERROR ("Attribute name="<<name<<" tid="<<tid.GetName () << ": input value is not a string");
46.176 + }
46.177 + Ptr<AttributeValue> v = info.checker->Create ();
46.178 + ok = info.accessor->Get (this, *PeekPointer (v));
46.179 if (!ok)
46.180 {
46.181 - NS_FATAL_ERROR ("Attribute name="<<name<<" is not gettable for this object: tid="<<tid.GetName ());
46.182 + NS_FATAL_ERROR ("Attribute name="<<name<<" tid="<<tid.GetName () << ": could not get value");
46.183 }
46.184 - std::string value = v.SerializeToString (info.checker);
46.185 - return value;
46.186 + str->Set (v->SerializeToString (info.checker));
46.187 }
46.188
46.189 -Attribute
46.190 -ObjectBase::GetAttribute (std::string name) const
46.191 -{
46.192 - struct TypeId::AttributeInfo info;
46.193 - TypeId tid = GetInstanceTypeId ();
46.194 - if (!tid.LookupAttributeByName (name, &info))
46.195 - {
46.196 - return Attribute ();
46.197 - }
46.198 - if (!(info.flags & TypeId::ATTR_GET))
46.199 - {
46.200 - return Attribute ();
46.201 - }
46.202 - Attribute value = info.checker->Create ();
46.203 - bool ok = info.accessor->Get (this, value);
46.204 - if (!ok)
46.205 - {
46.206 - return Attribute ();
46.207 - }
46.208 - return value;
46.209 -}
46.210
46.211 bool
46.212 -ObjectBase::GetAttributeAsStringFailSafe (std::string name, std::string &value) const
46.213 +ObjectBase::GetAttributeFailSafe (std::string name, AttributeValue &value) const
46.214 {
46.215 struct TypeId::AttributeInfo info;
46.216 TypeId tid = GetInstanceTypeId ();
46.217 @@ -229,35 +224,29 @@
46.218 {
46.219 return false;
46.220 }
46.221 - if (!(info.flags & TypeId::ATTR_GET))
46.222 + if (!(info.flags & TypeId::ATTR_GET) ||
46.223 + !info.accessor->HasGetter ())
46.224 {
46.225 return false;
46.226 }
46.227 - Attribute v = info.checker->Create ();
46.228 - bool ok = info.accessor->Get (this, v);
46.229 + bool ok = info.accessor->Get (this, value);
46.230 if (ok)
46.231 {
46.232 - value = v.SerializeToString (info.checker);
46.233 + return true;
46.234 }
46.235 - return ok;
46.236 -}
46.237 -
46.238 -bool
46.239 -ObjectBase::GetAttributeFailSafe (std::string name, Attribute &value) const
46.240 -{
46.241 - struct TypeId::AttributeInfo info;
46.242 - TypeId tid = GetInstanceTypeId ();
46.243 - if (!tid.LookupAttributeByName (name, &info))
46.244 + StringValue *str = dynamic_cast<StringValue *> (&value);
46.245 + if (str == 0)
46.246 {
46.247 return false;
46.248 }
46.249 - if (!(info.flags & TypeId::ATTR_GET))
46.250 + Ptr<AttributeValue> v = info.checker->Create ();
46.251 + ok = info.accessor->Get (this, *PeekPointer (v));
46.252 + if (!ok)
46.253 {
46.254 return false;
46.255 }
46.256 - value = info.checker->Create ();
46.257 - bool ok = info.accessor->Get (this, value);
46.258 - return ok;
46.259 + str->Set (v->SerializeToString (info.checker));
46.260 + return true;
46.261 }
46.262
46.263 bool
47.1 --- a/src/core/object-base.h Mon Apr 14 16:19:17 2008 -0700
47.2 +++ b/src/core/object-base.h Thu Apr 17 13:42:25 2008 -0700
47.3 @@ -22,7 +22,6 @@
47.4
47.5 #include "type-id.h"
47.6 #include "callback.h"
47.7 -#include "attribute-list.h"
47.8 #include <string>
47.9
47.10 /**
47.11 @@ -40,6 +39,8 @@
47.12
47.13 namespace ns3 {
47.14
47.15 +class AttributeList;
47.16 +
47.17 /**
47.18 * \brief implement the ns-3 type and attribute system
47.19 *
47.20 @@ -72,35 +73,21 @@
47.21 * Set a single attribute. This cannot fail: if the input is invalid,
47.22 * it will crash immediately.
47.23 */
47.24 - void SetAttribute (std::string name, Attribute value);
47.25 + void SetAttribute (std::string name, const AttributeValue &value);
47.26 /**
47.27 * \param name the name of the attribute to set
47.28 * \param value the name of the attribute to set
47.29 * \returns true if the requested attribute exists and could be set,
47.30 * false otherwise.
47.31 */
47.32 - bool SetAttributeFailSafe (std::string name, Attribute value);
47.33 - /**
47.34 - * \param name the name of the attribute to read
47.35 - * \returns true if the requested attribute was found, false otherwise.
47.36 - *
47.37 - * If the input attribute name does not exist, this method crashes.
47.38 - */
47.39 - std::string GetAttributeAsString (std::string name) const;
47.40 + bool SetAttributeFailSafe (std::string name, const AttributeValue &value);
47.41 /**
47.42 * \param name the name of the attribute to read
47.43 * \returns the attribute read.
47.44 *
47.45 * If the input attribute name does not exist, this method crashes.
47.46 */
47.47 - Attribute GetAttribute (std::string name) const;
47.48 -
47.49 - /**
47.50 - * \param name the name of the attribute to read
47.51 - * \param value the string where the result value should be stored
47.52 - * \returns true if the requested attribute was found, false otherwise.
47.53 - */
47.54 - bool GetAttributeAsStringFailSafe (std::string name, std::string &value) const;
47.55 + void GetAttribute (std::string name, AttributeValue &value) const;
47.56 /**
47.57 * \param name the name of the attribute to read
47.58 * \param attribute the attribute where the result value should be stored
47.59 @@ -108,7 +95,7 @@
47.60 *
47.61 * If the input attribute name does not exist, this method crashes.
47.62 */
47.63 - bool GetAttributeFailSafe (std::string name, Attribute &attribute) const;
47.64 + bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const;
47.65
47.66 /**
47.67 * \param name the name of the targetted trace source
47.68 @@ -163,8 +150,9 @@
47.69 void ConstructSelf (const AttributeList &attributes);
47.70
47.71 private:
47.72 - bool DoSet (Ptr<const AttributeAccessor> spec, Attribute intialValue,
47.73 - Ptr<const AttributeChecker> checker, Attribute value);
47.74 + bool DoSet (Ptr<const AttributeAccessor> spec,
47.75 + Ptr<const AttributeChecker> checker,
47.76 + const AttributeValue &value);
47.77
47.78 };
47.79
48.1 --- a/src/core/object-factory.cc Mon Apr 14 16:19:17 2008 -0700
48.2 +++ b/src/core/object-factory.cc Thu Apr 17 13:42:25 2008 -0700
48.3 @@ -41,7 +41,7 @@
48.4 m_tid = TypeId::LookupByName (tid);
48.5 }
48.6 void
48.7 -ObjectFactory::Set (std::string name, Attribute value)
48.8 +ObjectFactory::Set (std::string name, const AttributeValue &value)
48.9 {
48.10 if (name == "")
48.11 {
49.1 --- a/src/core/object-factory.h Mon Apr 14 16:19:17 2008 -0700
49.2 +++ b/src/core/object-factory.h Thu Apr 17 13:42:25 2008 -0700
49.3 @@ -20,11 +20,14 @@
49.4 #ifndef OBJECT_FACTORY_H
49.5 #define OBJECT_FACTORY_H
49.6
49.7 -#include "attribute.h"
49.8 +#include "attribute-list.h"
49.9 #include "object.h"
49.10 +#include "type-id.h"
49.11
49.12 namespace ns3 {
49.13
49.14 +class AttributeValue;
49.15 +
49.16 /**
49.17 * \brief instantiate subclasses of ns3::Object.
49.18 *
49.19 @@ -52,7 +55,7 @@
49.20 * \param name the name of the attribute to set during object construction
49.21 * \param value the value of the attribute to set during object construction
49.22 */
49.23 - void Set (std::string name, Attribute value);
49.24 + void Set (std::string name, const AttributeValue &value);
49.25
49.26 /**
49.27 * \returns the currently-selected TypeId to use to create an object
50.1 --- a/src/core/object-vector.cc Mon Apr 14 16:19:17 2008 -0700
50.2 +++ b/src/core/object-vector.cc Thu Apr 17 13:42:25 2008 -0700
50.3 @@ -2,63 +2,34 @@
50.4
50.5 namespace ns3 {
50.6
50.7 -ObjectVector::ObjectVector ()
50.8 +ObjectVectorValue::ObjectVectorValue ()
50.9 {}
50.10
50.11 -ObjectVector::Iterator
50.12 -ObjectVector::Begin (void) const
50.13 +ObjectVectorValue::Iterator
50.14 +ObjectVectorValue::Begin (void) const
50.15 {
50.16 return m_objects.begin ();
50.17 }
50.18 -ObjectVector::Iterator
50.19 -ObjectVector::End (void) const
50.20 +ObjectVectorValue::Iterator
50.21 +ObjectVectorValue::End (void) const
50.22 {
50.23 return m_objects.end ();
50.24 }
50.25 uint32_t
50.26 -ObjectVector::GetN (void) const
50.27 +ObjectVectorValue::GetN (void) const
50.28 {
50.29 return m_objects.size ();
50.30 }
50.31 Ptr<Object>
50.32 -ObjectVector::Get (uint32_t i) const
50.33 +ObjectVectorValue::Get (uint32_t i) const
50.34 {
50.35 return m_objects[i];
50.36 }
50.37
50.38 -ObjectVector::ObjectVector (Attribute value)
50.39 -{
50.40 - const ObjectVectorValue *v = value.DynCast<const ObjectVectorValue *> ();
50.41 - if (v == 0)
50.42 - {
50.43 - NS_FATAL_ERROR ("Expected value of type ObjectVectorValue.");
50.44 - }
50.45 - *this = v->Get ();
50.46 -}
50.47 -
50.48 -ObjectVector::operator Attribute () const
50.49 -{
50.50 - return Attribute (ns3::Create<ObjectVectorValue> ());
50.51 -}
50.52 -
50.53 -ObjectVectorValue::ObjectVectorValue ()
50.54 - : m_vector ()
50.55 -{}
50.56 -
50.57 -ObjectVectorValue::ObjectVectorValue (const ObjectVector &vector)
50.58 - : m_vector (vector)
50.59 -{}
50.60 -
50.61 -ObjectVector
50.62 -ObjectVectorValue::Get (void) const
50.63 -{
50.64 - return m_vector;
50.65 -}
50.66 -
50.67 -Attribute
50.68 +Ptr<AttributeValue>
50.69 ObjectVectorValue::Copy (void) const
50.70 {
50.71 - return Attribute (ns3::Create<ObjectVectorValue> (*this));
50.72 + return ns3::Create<ObjectVectorValue> (*this);
50.73 }
50.74 std::string
50.75 ObjectVectorValue::SerializeToString (Ptr<const AttributeChecker> checker) const
50.76 @@ -69,25 +40,25 @@
50.77 bool
50.78 ObjectVectorValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
50.79 {
50.80 - // XXX ?? Can we implement this correctly ?? I doubt it very much.
50.81 + NS_FATAL_ERROR ("cannot deserialize a vector of object pointers.");
50.82 return true;
50.83 }
50.84
50.85 bool
50.86 -ObjectVectorAccessor::Set (ObjectBase * object, Attribute value) const
50.87 +ObjectVectorAccessor::Set (ObjectBase * object, const AttributeValue & value) const
50.88 {
50.89 // not allowed.
50.90 return false;
50.91 }
50.92 bool
50.93 -ObjectVectorAccessor::Get (const ObjectBase * object, Attribute value) const
50.94 +ObjectVectorAccessor::Get (const ObjectBase * object, AttributeValue &value) const
50.95 {
50.96 - ObjectVectorValue *v = value.DynCast<ObjectVectorValue *> ();
50.97 + ObjectVectorValue *v = dynamic_cast<ObjectVectorValue *> (&value);
50.98 if (v == 0)
50.99 {
50.100 return false;
50.101 }
50.102 - v->m_vector.m_objects.clear ();
50.103 + v->m_objects.clear ();
50.104 uint32_t n;
50.105 bool ok = DoGetN (object, &n);
50.106 if (!ok)
50.107 @@ -97,7 +68,7 @@
50.108 for (uint32_t i = 0; i < n; i++)
50.109 {
50.110 Ptr<Object> o = DoGet (object, i);
50.111 - v->m_vector.m_objects.push_back (o);
50.112 + v->m_objects.push_back (o);
50.113 }
50.114 return true;
50.115 }
51.1 --- a/src/core/object-vector.h Mon Apr 14 16:19:17 2008 -0700
51.2 +++ b/src/core/object-vector.h Thu Apr 17 13:42:25 2008 -0700
51.3 @@ -14,20 +14,22 @@
51.4 * This class it used to get attribute access to an array of
51.5 * ns3::Object pointers.
51.6 */
51.7 -class ObjectVector
51.8 +class ObjectVectorValue : public AttributeValue
51.9 {
51.10 public:
51.11 typedef std::vector<Ptr<Object> >::const_iterator Iterator;
51.12
51.13 - ObjectVector ();
51.14 + ObjectVectorValue ();
51.15
51.16 Iterator Begin (void) const;
51.17 Iterator End (void) const;
51.18 uint32_t GetN (void) const;
51.19 Ptr<Object> Get (uint32_t i) const;
51.20
51.21 - ObjectVector (Attribute value);
51.22 - operator Attribute () const;
51.23 + virtual Ptr<AttributeValue> Copy (void) const;
51.24 + virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
51.25 + virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
51.26 +
51.27 private:
51.28 friend class ObjectVectorAccessor;
51.29 std::vector<Ptr<Object> > m_objects;
51.30 @@ -60,24 +62,6 @@
51.31
51.32 namespace ns3 {
51.33
51.34 -class ObjectVectorValue : public AttributeValue
51.35 -{
51.36 -public:
51.37 - ObjectVectorValue ();
51.38 - ObjectVectorValue (const ObjectVector &vector);
51.39 -
51.40 - ObjectVector Get (void) const;
51.41 -
51.42 - virtual Attribute Copy (void) const;
51.43 - virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
51.44 - virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
51.45 -
51.46 -private:
51.47 - friend class ObjectVectorAccessor;
51.48 - ObjectVector m_vector;
51.49 -};
51.50 -
51.51 -
51.52 namespace internal {
51.53
51.54 template <typename T>
51.55 @@ -87,8 +71,8 @@
51.56 virtual TypeId GetItemTypeId (void) const {
51.57 return T::GetTypeId ();
51.58 }
51.59 - virtual bool Check (Attribute value) const {
51.60 - return value.DynCast<const ObjectVectorValue *> () != 0;
51.61 + virtual bool Check (const AttributeValue &value) const {
51.62 + return dynamic_cast<const ObjectVectorValue *> (&value) != 0;
51.63 }
51.64 virtual std::string GetType (void) const {
51.65 return "ns3::ObjectVector";
51.66 @@ -99,8 +83,18 @@
51.67 virtual std::string GetTypeConstraints (void) const {
51.68 return T::GetTypeId ().GetName ();
51.69 }
51.70 - virtual Attribute Create (void) const {
51.71 - return Attribute (ns3::Create<ObjectVectorValue> ());
51.72 + virtual Ptr<AttributeValue> Create (void) const {
51.73 + return ns3::Create<ObjectVectorValue> ();
51.74 + }
51.75 + virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const {
51.76 + const ObjectVectorValue *src = dynamic_cast<const ObjectVectorValue *> (&source);
51.77 + ObjectVectorValue *dst = dynamic_cast<ObjectVectorValue *> (&destination);
51.78 + if (src == 0 || dst == 0)
51.79 + {
51.80 + return false;
51.81 + }
51.82 + *dst = *src;
51.83 + return true;
51.84 }
51.85 };
51.86
51.87 @@ -110,8 +104,8 @@
51.88 class ObjectVectorAccessor : public AttributeAccessor
51.89 {
51.90 public:
51.91 - virtual bool Set (ObjectBase * object, Attribute value) const;
51.92 - virtual bool Get (const ObjectBase * object, Attribute value) const;
51.93 + virtual bool Set (ObjectBase * object, const AttributeValue &value) const;
51.94 + virtual bool Get (const ObjectBase * object, AttributeValue &value) const;
51.95 virtual bool HasGetter (void) const;
51.96 virtual bool HasSetter (void) const;
51.97 private:
52.1 --- a/src/core/object.h Mon Apr 14 16:19:17 2008 -0700
52.2 +++ b/src/core/object.h Thu Apr 17 13:42:25 2008 -0700
52.3 @@ -283,15 +283,15 @@
52.4 */
52.5 template <typename T>
52.6 Ptr<T>
52.7 -CreateObject (std::string n1 = "", Attribute v1 = Attribute (),
52.8 - std::string n2 = "", Attribute v2 = Attribute (),
52.9 - std::string n3 = "", Attribute v3 = Attribute (),
52.10 - std::string n4 = "", Attribute v4 = Attribute (),
52.11 - std::string n5 = "", Attribute v5 = Attribute (),
52.12 - std::string n6 = "", Attribute v6 = Attribute (),
52.13 - std::string n7 = "", Attribute v7 = Attribute (),
52.14 - std::string n8 = "", Attribute v8 = Attribute (),
52.15 - std::string n9 = "", Attribute v9 = Attribute ());
52.16 +CreateObject (std::string n1 = "", const AttributeValue & v1 = EmptyAttributeValue (),
52.17 + std::string n2 = "", const AttributeValue & v2 = EmptyAttributeValue (),
52.18 + std::string n3 = "", const AttributeValue & v3 = EmptyAttributeValue (),
52.19 + std::string n4 = "", const AttributeValue & v4 = EmptyAttributeValue (),
52.20 + std::string n5 = "", const AttributeValue & v5 = EmptyAttributeValue (),
52.21 + std::string n6 = "", const AttributeValue & v6 = EmptyAttributeValue (),
52.22 + std::string n7 = "", const AttributeValue & v7 = EmptyAttributeValue (),
52.23 + std::string n8 = "", const AttributeValue & v8 = EmptyAttributeValue (),
52.24 + std::string n9 = "", const AttributeValue & v9 = EmptyAttributeValue ());
52.25
52.26
52.27
52.28 @@ -367,16 +367,15 @@
52.29
52.30 template <typename T>
52.31 Ptr<T>
52.32 -CreateObject (std::string n1 = "", Attribute v1 = Attribute (),
52.33 - std::string n2 = "", Attribute v2 = Attribute (),
52.34 - std::string n3 = "", Attribute v3 = Attribute (),
52.35 - std::string n4 = "", Attribute v4 = Attribute (),
52.36 - std::string n5 = "", Attribute v5 = Attribute (),
52.37 - std::string n6 = "", Attribute v6 = Attribute (),
52.38 - std::string n7 = "", Attribute v7 = Attribute (),
52.39 - std::string n8 = "", Attribute v8 = Attribute (),
52.40 - std::string n9 = "", Attribute v9 = Attribute ())
52.41 -
52.42 +CreateObject (std::string n1 = "", const AttributeValue & v1 = EmptyAttributeValue (),
52.43 + std::string n2 = "", const AttributeValue & v2 = EmptyAttributeValue (),
52.44 + std::string n3 = "", const AttributeValue & v3 = EmptyAttributeValue (),
52.45 + std::string n4 = "", const AttributeValue & v4 = EmptyAttributeValue (),
52.46 + std::string n5 = "", const AttributeValue & v5 = EmptyAttributeValue (),
52.47 + std::string n6 = "", const AttributeValue & v6 = EmptyAttributeValue (),
52.48 + std::string n7 = "", const AttributeValue & v7 = EmptyAttributeValue (),
52.49 + std::string n8 = "", const AttributeValue & v8 = EmptyAttributeValue (),
52.50 + std::string n9 = "", const AttributeValue & v9 = EmptyAttributeValue ())
52.51 {
52.52 AttributeList attributes;
52.53 if (n1 == "")
53.1 --- a/src/core/pointer.cc Mon Apr 14 16:19:17 2008 -0700
53.2 +++ b/src/core/pointer.cc Thu Apr 17 13:42:25 2008 -0700
53.3 @@ -21,39 +21,44 @@
53.4
53.5 namespace ns3 {
53.6
53.7 -Pointer::Pointer ()
53.8 +PointerValue::PointerValue ()
53.9 : m_value ()
53.10 {}
53.11
53.12 -Pointer::Pointer (Ptr<Object> object)
53.13 +PointerValue::PointerValue (Ptr<Object> object)
53.14 : m_value (object)
53.15 {}
53.16
53.17 void
53.18 -Pointer::SetObject (Ptr<Object> object)
53.19 +PointerValue::SetObject (Ptr<Object> object)
53.20 {
53.21 m_value = object;
53.22 }
53.23
53.24 Ptr<Object>
53.25 -Pointer::GetObject (void) const
53.26 +PointerValue::GetObject (void) const
53.27 {
53.28 return m_value;
53.29 }
53.30
53.31 -ATTRIBUTE_VALUE_IMPLEMENT (Pointer);
53.32 -ATTRIBUTE_CONVERTER_IMPLEMENT (Pointer);
53.33 -
53.34 -std::ostream & operator << (std::ostream &os, const Pointer &pointer)
53.35 +Ptr<AttributeValue>
53.36 +PointerValue::Copy (void) const
53.37 {
53.38 - os << pointer.GetObject ();
53.39 - return os;
53.40 + return Create<PointerValue> (*this);
53.41 }
53.42 -std::istream & operator >> (std::istream &is, Pointer &pointer)
53.43 +std::string
53.44 +PointerValue::SerializeToString (Ptr<const AttributeChecker> checker) const
53.45 {
53.46 - // XXX: This cannot work;
53.47 - return is;
53.48 + std::ostringstream oss;
53.49 + oss << m_value;
53.50 + return oss.str ();
53.51 }
53.52
53.53 +bool
53.54 +PointerValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
53.55 +{
53.56 + NS_FATAL_ERROR ("It is not possible to deserialize a pointer.");
53.57 + return false;
53.58 +}
53.59
53.60 } // namespace ns3
54.1 --- a/src/core/pointer.h Mon Apr 14 16:19:17 2008 -0700
54.2 +++ b/src/core/pointer.h Thu Apr 17 13:42:25 2008 -0700
54.3 @@ -25,19 +25,19 @@
54.4
54.5 namespace ns3 {
54.6
54.7 -class Pointer
54.8 +class PointerValue : public AttributeValue
54.9 {
54.10 public:
54.11 - Pointer ();
54.12 + PointerValue ();
54.13
54.14 - Pointer (Ptr<Object> object);
54.15 + PointerValue (Ptr<Object> object);
54.16
54.17 void SetObject (Ptr<Object> object);
54.18
54.19 Ptr<Object> GetObject (void) const;
54.20
54.21 template <typename T>
54.22 - Pointer (const Ptr<T> &object);
54.23 + PointerValue (const Ptr<T> &object);
54.24
54.25 template <typename T>
54.26 void Set (const Ptr<T> &object);
54.27 @@ -48,16 +48,14 @@
54.28 template <typename T>
54.29 operator Ptr<T> () const;
54.30
54.31 - ATTRIBUTE_CONVERTER_DEFINE (Pointer);
54.32 + virtual Ptr<AttributeValue> Copy (void) const;
54.33 + virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
54.34 + virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
54.35 +
54.36 private:
54.37 Ptr<Object> m_value;
54.38 };
54.39
54.40 -std::ostream & operator << (std::ostream &os, const Pointer &pointer);
54.41 -std::istream & operator >> (std::istream &is, Pointer &pointer);
54.42 -
54.43 -ATTRIBUTE_VALUE_DEFINE (Pointer);
54.44 -
54.45 template <typename T, typename U>
54.46 Ptr<const AttributeAccessor>
54.47 MakePointerAccessor (Ptr<U> T::*memberVariable);
54.48 @@ -94,17 +92,17 @@
54.49 template <typename T>
54.50 class APointerChecker : public PointerChecker
54.51 {
54.52 - virtual bool Check (Attribute val) const {
54.53 - const PointerValue *value = val.DynCast<const PointerValue *> ();
54.54 + virtual bool Check (const AttributeValue &val) const {
54.55 + const PointerValue *value = dynamic_cast<const PointerValue *> (&val);
54.56 if (value == 0)
54.57 {
54.58 return false;
54.59 }
54.60 - if (value->Get ().GetObject () == 0)
54.61 + if (value->GetObject () == 0)
54.62 {
54.63 return true;
54.64 }
54.65 - T *ptr = dynamic_cast<T*> (PeekPointer (value->Get ().GetObject ()));
54.66 + T *ptr = dynamic_cast<T*> (PeekPointer (value->GetObject ()));
54.67 if (ptr == 0)
54.68 {
54.69 return false;
54.70 @@ -122,8 +120,18 @@
54.71 virtual std::string GetTypeConstraints (void) const {
54.72 return "";
54.73 }
54.74 - virtual Attribute Create (void) const {
54.75 - return Attribute (ns3::Create<PointerValue> ());
54.76 + virtual Ptr<AttributeValue> Create (void) const {
54.77 + return ns3::Create<PointerValue> ();
54.78 + }
54.79 + virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const {
54.80 + const PointerValue *src = dynamic_cast<const PointerValue *> (&source);
54.81 + PointerValue *dst = dynamic_cast<PointerValue *> (&destination);
54.82 + if (src == 0 || dst == 0)
54.83 + {
54.84 + return false;
54.85 + }
54.86 + *dst = *src;
54.87 + return true;
54.88 }
54.89 virtual TypeId GetPointeeTypeId (void) const {
54.90 return T::GetTypeId ();
54.91 @@ -140,18 +148,18 @@
54.92 {
54.93 public:
54.94 virtual ~PointerAccessor () {}
54.95 - virtual bool Set (ObjectBase * object, Attribute val) const {
54.96 + virtual bool Set (ObjectBase * object, const AttributeValue &val) const {
54.97 T *obj = dynamic_cast<T *> (object);
54.98 if (obj == 0)
54.99 {
54.100 return false;
54.101 }
54.102 - const PointerValue *value = val.DynCast<const PointerValue *> ();
54.103 + const PointerValue *value = dynamic_cast<const PointerValue *> (&val);
54.104 if (value == 0)
54.105 {
54.106 return false;
54.107 }
54.108 - Ptr<U> ptr = dynamic_cast<U*> (PeekPointer (value->Get ().GetObject ()));
54.109 + Ptr<U> ptr = dynamic_cast<U*> (PeekPointer (value->GetObject ()));
54.110 if (ptr == 0)
54.111 {
54.112 return false;
54.113 @@ -159,18 +167,18 @@
54.114 DoSet (obj, ptr);
54.115 return true;
54.116 }
54.117 - virtual bool Get (const ObjectBase * object, Attribute val) const {
54.118 + virtual bool Get (const ObjectBase * object, AttributeValue &val) const {
54.119 const T *obj = dynamic_cast<const T *> (object);
54.120 if (obj == 0)
54.121 {
54.122 return false;
54.123 }
54.124 - PointerValue *value = val.DynCast<PointerValue *> ();
54.125 + PointerValue *value = dynamic_cast<PointerValue *> (&val);
54.126 if (value == 0)
54.127 {
54.128 return false;
54.129 }
54.130 - value->Set (Pointer (DoGet (obj)));
54.131 + value->Set (DoGet (obj));
54.132 return true;
54.133 }
54.134 private:
54.135 @@ -182,28 +190,28 @@
54.136
54.137
54.138 template <typename T>
54.139 -Pointer::Pointer (const Ptr<T> &object)
54.140 +PointerValue::PointerValue (const Ptr<T> &object)
54.141 {
54.142 m_value = object;
54.143 }
54.144
54.145 template <typename T>
54.146 void
54.147 -Pointer::Set (const Ptr<T> &object)
54.148 +PointerValue::Set (const Ptr<T> &object)
54.149 {
54.150 m_value = object;
54.151 }
54.152
54.153 template <typename T>
54.154 Ptr<T>
54.155 -Pointer::Get (void) const
54.156 +PointerValue::Get (void) const
54.157 {
54.158 T *v = dynamic_cast<T *> (PeekPointer (m_value));
54.159 return v;
54.160 }
54.161
54.162 template <typename T>
54.163 -Pointer::operator Ptr<T> () const
54.164 +PointerValue::operator Ptr<T> () const
54.165 {
54.166 return Get<T> ();
54.167 }
55.1 --- a/src/core/ptr.h Mon Apr 14 16:19:17 2008 -0700
55.2 +++ b/src/core/ptr.h Thu Apr 17 13:42:25 2008 -0700
55.3 @@ -447,7 +447,6 @@
55.4 return *m_ptr;
55.5 }
55.6
55.7 -
55.8 template <typename T>
55.9 bool
55.10 Ptr<T>::operator! ()
56.1 --- a/src/core/random-variable.cc Mon Apr 14 16:19:17 2008 -0700
56.2 +++ b/src/core/random-variable.cc Thu Apr 17 13:42:25 2008 -0700
56.3 @@ -299,20 +299,6 @@
56.4 {
56.5 return m_variable;
56.6 }
56.7 -RandomVariable::RandomVariable (Attribute value)
56.8 - : m_variable (0)
56.9 -{
56.10 - const RandomVariableValue *v = value.DynCast<const RandomVariableValue *> ();
56.11 - if (v == 0)
56.12 - {
56.13 - NS_FATAL_ERROR ("Unexpected type of value. Expected \"RandomVariableValue\"");
56.14 - }
56.15 - *this = v->Get ();
56.16 -}
56.17 -RandomVariable::operator Attribute () const
56.18 -{
56.19 - return Attribute (ns3::Create<RandomVariableValue> (*this));
56.20 -}
56.21
56.22 ATTRIBUTE_VALUE_IMPLEMENT (RandomVariable);
56.23 ATTRIBUTE_CHECKER_IMPLEMENT (RandomVariable);
56.24 @@ -1267,7 +1253,7 @@
56.25
56.26 //-----------------------------------------------------------------------------
56.27 //-----------------------------------------------------------------------------
56.28 -// Integer EmpiricalVariableImpl methods
56.29 +// IntegerValue EmpiricalVariableImpl methods
56.30 class IntEmpiricalVariableImpl : public EmpiricalVariableImpl {
56.31 public:
56.32
57.1 --- a/src/core/random-variable.h Mon Apr 14 16:19:17 2008 -0700
57.2 +++ b/src/core/random-variable.h Thu Apr 17 13:42:25 2008 -0700
57.3 @@ -163,10 +163,6 @@
57.4 */
57.5 static void SetRunNumber(uint32_t n);
57.6
57.7 -
57.8 - RandomVariable (Attribute value);
57.9 - operator Attribute () const;
57.10 -
57.11 private:
57.12 friend std::ostream &operator << (std::ostream &os, const RandomVariable &var);
57.13 friend std::istream &operator >> (std::istream &os, RandomVariable &var);
58.1 --- a/src/core/string.cc Mon Apr 14 16:19:17 2008 -0700
58.2 +++ b/src/core/string.cc Thu Apr 17 13:42:25 2008 -0700
58.3 @@ -2,49 +2,8 @@
58.4
58.5 namespace ns3 {
58.6
58.7 -String::String ()
58.8 - : m_value ()
58.9 -{}
58.10 -String::String (const char *value)
58.11 - : m_value (value)
58.12 -{}
58.13 -String::String (std::string value)
58.14 - : m_value (value)
58.15 -{}
58.16 -void
58.17 -String::Set (std::string value)
58.18 -{
58.19 - m_value = value;
58.20 -}
58.21 -void
58.22 -String::Set (const char *value)
58.23 -{
58.24 - m_value = value;
58.25 -}
58.26 -std::string
58.27 -String::Get (void) const
58.28 -{
58.29 - return m_value;
58.30 -}
58.31 -
58.32 -String::operator std::string () const
58.33 -{
58.34 - return m_value;
58.35 -}
58.36 -
58.37 -std::ostream & operator << (std::ostream &os, const String &value)
58.38 -{
58.39 - os << value.Get ();
58.40 - return os;
58.41 -}
58.42 -std::istream &operator >> (std::istream &is, String &value)
58.43 -{
58.44 - std::string str;
58.45 - is >> str;
58.46 - value = String (str);
58.47 - return is;
58.48 -}
58.49 -
58.50 -ATTRIBUTE_HELPER_CPP (String);
58.51 +ATTRIBUTE_CHECKER_IMPLEMENT (String);
58.52 +ATTRIBUTE_CONVERTER_IMPLEMENT (String);
58.53 +ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME (std::string, String);
58.54
58.55 } // namespace ns3
59.1 --- a/src/core/string.h Mon Apr 14 16:19:17 2008 -0700
59.2 +++ b/src/core/string.h Thu Apr 17 13:42:25 2008 -0700
59.3 @@ -12,27 +12,10 @@
59.4 * This class can be used to hold variables of type string,
59.5 * that is, either char * or std::string.
59.6 */
59.7 -class String
59.8 -{
59.9 -public:
59.10 - String ();
59.11 - String (const char *value);
59.12 - String (std::string value);
59.13 - void Set (std::string value);
59.14 - void Set (const char *value);
59.15 - std::string Get (void) const;
59.16
59.17 - operator std::string () const;
59.18 -
59.19 - ATTRIBUTE_HELPER_HEADER_1 (String);
59.20 -private:
59.21 - std::string m_value;
59.22 -};
59.23 -
59.24 -std::ostream & operator << (std::ostream &os, const String &value);
59.25 -std::istream &operator >> (std::istream &is, String &value);
59.26 -
59.27 -ATTRIBUTE_HELPER_HEADER_2 (String);
59.28 +ATTRIBUTE_VALUE_DEFINE_WITH_NAME (std::string, String);
59.29 +ATTRIBUTE_ACCESSOR_DEFINE (String);
59.30 +ATTRIBUTE_CHECKER_DEFINE (String);
59.31
59.32 } // namespace ns3
59.33
60.1 --- a/src/core/traced-value.h Mon Apr 14 16:19:17 2008 -0700
60.2 +++ b/src/core/traced-value.h Thu Apr 17 13:42:25 2008 -0700
60.3 @@ -60,25 +60,25 @@
60.4 Set (o.m_v);
60.5 return *this;
60.6 }
60.7 - TracedValue (const Integer &value)
60.8 + TracedValue (const IntegerValue &value)
60.9 : m_v (value.Get ()) {}
60.10 - operator Integer () const {
60.11 - return Integer (m_v);
60.12 + operator IntegerValue () const {
60.13 + return IntegerValue (m_v);
60.14 }
60.15 - TracedValue (const Uinteger &value)
60.16 + TracedValue (const UintegerValue &value)
60.17 : m_v (value.Get ()) {}
60.18 - operator Uinteger () const {
60.19 - return Uinteger (m_v);
60.20 + operator UintegerValue () const {
60.21 + return UintegerValue (m_v);
60.22 }
60.23 - TracedValue (const Boolean &value)
60.24 + TracedValue (const BooleanValue &value)
60.25 : m_v (value.Get ()) {}
60.26 - operator Boolean () const {
60.27 - return Boolean (m_v);
60.28 + operator BooleanValue () const {
60.29 + return BooleanValue (m_v);
60.30 }
60.31 - TracedValue (const Enum &value)
60.32 + TracedValue (const EnumValue &value)
60.33 : m_v (value.Get ()) {}
60.34 - operator Enum () const {
60.35 - return Enum (m_v);
60.36 + operator EnumValue () const {
60.37 + return EnumValue (m_v);
60.38 }
60.39 void ConnectWithoutContext (const CallbackBase &cb) {
60.40 m_cb.ConnectWithoutContext (cb);
61.1 --- a/src/core/type-id.cc Mon Apr 14 16:19:17 2008 -0700
61.2 +++ b/src/core/type-id.cc Thu Apr 17 13:42:25 2008 -0700
61.3 @@ -50,14 +50,14 @@
61.4 std::string name,
61.5 std::string help,
61.6 uint32_t flags,
61.7 - ns3::Attribute initialValue,
61.8 + ns3::Ptr<const ns3::AttributeValue> initialValue,
61.9 ns3::Ptr<const ns3::AttributeAccessor> spec,
61.10 ns3::Ptr<const ns3::AttributeChecker> checker);
61.11 uint32_t GetAttributeN (uint16_t uid) const;
61.12 std::string GetAttributeName (uint16_t uid, uint32_t i) const;
61.13 std::string GetAttributeHelp (uint16_t uid, uint32_t i) const;
61.14 uint32_t GetAttributeFlags (uint16_t uid, uint32_t i) const;
61.15 - ns3::Attribute GetAttributeInitialValue (uint16_t uid, uint32_t i) const;
61.16 + ns3::Ptr<const ns3::AttributeValue> GetAttributeInitialValue (uint16_t uid, uint32_t i) const;
61.17 ns3::Ptr<const ns3::AttributeAccessor> GetAttributeAccessor (uint16_t uid, uint32_t i) const;
61.18 ns3::Ptr<const ns3::AttributeChecker> GetAttributeChecker (uint16_t uid, uint32_t i) const;
61.19 void AddTraceSource (uint16_t uid,
61.20 @@ -75,7 +75,7 @@
61.21 std::string name;
61.22 std::string help;
61.23 uint32_t flags;
61.24 - ns3::Attribute initialValue;
61.25 + ns3::Ptr<const ns3::AttributeValue> initialValue;
61.26 ns3::Ptr<const ns3::AttributeAccessor> param;
61.27 ns3::Ptr<const ns3::AttributeChecker> checker;
61.28 };
61.29 @@ -236,7 +236,7 @@
61.30 std::string name,
61.31 std::string help,
61.32 uint32_t flags,
61.33 - ns3::Attribute initialValue,
61.34 + ns3::Ptr<const ns3::AttributeValue> initialValue,
61.35 ns3::Ptr<const ns3::AttributeAccessor> spec,
61.36 ns3::Ptr<const ns3::AttributeChecker> checker)
61.37 {
61.38 @@ -288,7 +288,7 @@
61.39 NS_ASSERT (i < information->attributes.size ());
61.40 return information->attributes[i].flags;
61.41 }
61.42 -ns3::Attribute
61.43 +ns3::Ptr<const ns3::AttributeValue>
61.44 IidManager::GetAttributeInitialValue (uint16_t uid, uint32_t i) const
61.45 {
61.46 struct IidInformation *information = LookupInformation (uid);
61.47 @@ -512,11 +512,11 @@
61.48 TypeId
61.49 TypeId::AddAttribute (std::string name,
61.50 std::string help,
61.51 - Attribute initialValue,
61.52 + const AttributeValue &initialValue,
61.53 Ptr<const AttributeAccessor> param,
61.54 Ptr<const AttributeChecker> checker)
61.55 {
61.56 - Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, ATTR_SGC, initialValue, param, checker);
61.57 + Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, ATTR_SGC, initialValue.Copy (), param, checker);
61.58 return *this;
61.59 }
61.60
61.61 @@ -524,11 +524,11 @@
61.62 TypeId::AddAttribute (std::string name,
61.63 std::string help,
61.64 uint32_t flags,
61.65 - Attribute initialValue,
61.66 + const AttributeValue &initialValue,
61.67 Ptr<const AttributeAccessor> param,
61.68 Ptr<const AttributeChecker> checker)
61.69 {
61.70 - Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, flags, initialValue, param, checker);
61.71 + Singleton<IidManager>::Get ()->AddAttribute (m_tid, name, help, flags, initialValue.Copy (), param, checker);
61.72 return *this;
61.73 }
61.74
61.75 @@ -569,10 +569,10 @@
61.76 {
61.77 return GetName () + "::" + GetAttributeName (i);
61.78 }
61.79 -Attribute
61.80 +Ptr<const AttributeValue>
61.81 TypeId::GetAttributeInitialValue (uint32_t i) const
61.82 {
61.83 - Attribute value = Singleton<IidManager>::Get ()->GetAttributeInitialValue (m_tid, i);
61.84 + Ptr<const AttributeValue> value = Singleton<IidManager>::Get ()->GetAttributeInitialValue (m_tid, i);
61.85 return value;
61.86 }
61.87 Ptr<const AttributeAccessor>
62.1 --- a/src/core/type-id.h Mon Apr 14 16:19:17 2008 -0700
62.2 +++ b/src/core/type-id.h Thu Apr 17 13:42:25 2008 -0700
62.3 @@ -163,7 +163,7 @@
62.4 * \returns the value with which the associated attribute
62.5 * is initialized.
62.6 */
62.7 - Attribute GetAttributeInitialValue (uint32_t i) const;
62.8 + Ptr<const AttributeValue> GetAttributeInitialValue (uint32_t i) const;
62.9 /**
62.10 * \param i index into attribute array.
62.11 * \returns the flags associated to the requested attribute.
62.12 @@ -264,7 +264,7 @@
62.13 */
62.14 TypeId AddAttribute (std::string name,
62.15 std::string help,
62.16 - Attribute initialValue,
62.17 + const AttributeValue &initialValue,
62.18 Ptr<const AttributeAccessor> accessor,
62.19 Ptr<const AttributeChecker> checker);
62.20
62.21 @@ -283,7 +283,7 @@
62.22 TypeId AddAttribute (std::string name,
62.23 std::string help,
62.24 uint32_t flags,
62.25 - Attribute initialValue,
62.26 + const AttributeValue &initialValue,
62.27 Ptr<const AttributeAccessor> accessor,
62.28 Ptr<const AttributeChecker> checker);
62.29
62.30 @@ -308,7 +308,7 @@
62.31 // The accessor associated to the attribute.
62.32 Ptr<const AttributeAccessor> accessor;
62.33 // The initial value associated to the attribute.
62.34 - Attribute initialValue;
62.35 + Ptr<const AttributeValue> initialValue;
62.36 // The set of access control flags associated to the attribute.
62.37 uint32_t flags;
62.38 // The checker associated to the attribute.
63.1 --- a/src/core/uinteger.cc Mon Apr 14 16:19:17 2008 -0700
63.2 +++ b/src/core/uinteger.cc Thu Apr 17 13:42:25 2008 -0700
63.3 @@ -23,40 +23,7 @@
63.4
63.5 namespace ns3 {
63.6
63.7 -Uinteger::Uinteger (uint64_t value)
63.8 - : m_value (value)
63.9 -{}
63.10 -Uinteger::Uinteger ()
63.11 -{}
63.12 -void
63.13 -Uinteger::Set (uint64_t value)
63.14 -{
63.15 - m_value = value;
63.16 -}
63.17 -uint64_t
63.18 -Uinteger::Get (void) const
63.19 -{
63.20 - return m_value;
63.21 -}
63.22 -Uinteger::operator uint64_t () const
63.23 -{
63.24 - return m_value;
63.25 -}
63.26 -std::ostream & operator << (std::ostream &os, const Uinteger &uinteger)
63.27 -{
63.28 - os << uinteger.Get ();
63.29 - return os;
63.30 -}
63.31 -std::istream & operator >> (std::istream &is, Uinteger &uinteger)
63.32 -{
63.33 - uint64_t v;
63.34 - is >> v;
63.35 - uinteger.Set (v);
63.36 - return is;
63.37 -}
63.38 -
63.39 -ATTRIBUTE_CONVERTER_IMPLEMENT(Uinteger);
63.40 -ATTRIBUTE_VALUE_IMPLEMENT(Uinteger);
63.41 +ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME(uint64_t,Uinteger);
63.42
63.43 namespace internal {
63.44
63.45 @@ -68,13 +35,13 @@
63.46 : m_minValue (minValue),
63.47 m_maxValue (maxValue),
63.48 m_name (name) {}
63.49 - virtual bool Check (Attribute value) const {
63.50 - const UintegerValue *v = value.DynCast<const UintegerValue *> ();
63.51 + virtual bool Check (const AttributeValue &value) const {
63.52 + const UintegerValue *v = dynamic_cast<const UintegerValue *> (&value);
63.53 if (v == 0)
63.54 {
63.55 return false;
63.56 }
63.57 - return v->Get ().Get () >= m_minValue && v->Get ().Get () <= m_maxValue;
63.58 + return v->Get () >= m_minValue && v->Get () <= m_maxValue;
63.59 }
63.60 virtual std::string GetType (void) const {
63.61 return m_name;
63.62 @@ -87,8 +54,18 @@
63.63 oss << m_minValue << ":" << m_maxValue;
63.64 return oss.str ();
63.65 }
63.66 - virtual Attribute Create (void) const {
63.67 - return Attribute (ns3::Create<UintegerValue> ());
63.68 + virtual Ptr<AttributeValue> Create (void) const {
63.69 + return ns3::Create<UintegerValue> ();
63.70 + }
63.71 + virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const {
63.72 + const UintegerValue *src = dynamic_cast<const UintegerValue *> (&source);
63.73 + UintegerValue *dst = dynamic_cast<UintegerValue *> (&destination);
63.74 + if (src == 0 || dst == 0)
63.75 + {
63.76 + return false;
63.77 + }
63.78 + *dst = *src;
63.79 + return true;
63.80 }
63.81 uint64_t m_minValue;
63.82 uint64_t m_maxValue;
64.1 --- a/src/core/uinteger.h Mon Apr 14 16:19:17 2008 -0700
64.2 +++ b/src/core/uinteger.h Thu Apr 17 13:42:25 2008 -0700
64.3 @@ -38,26 +38,8 @@
64.4 * type such as uint8_t, uint16_t, uint32_t, uint64_t, or,
64.5 * unsigned int, etc.
64.6 */
64.7 -class Uinteger
64.8 -{
64.9 -public:
64.10 - Uinteger (uint64_t value);
64.11 - Uinteger ();
64.12
64.13 - void Set (uint64_t value);
64.14 - uint64_t Get (void) const;
64.15 -
64.16 - operator uint64_t () const;
64.17 -
64.18 - ATTRIBUTE_CONVERTER_DEFINE (Uinteger);
64.19 -private:
64.20 - uint64_t m_value;
64.21 -};
64.22 -
64.23 -std::ostream & operator << (std::ostream &os, const Uinteger &uinteger);
64.24 -std::istream & operator >> (std::istream &is, Uinteger &uinteger);
64.25 -
64.26 -ATTRIBUTE_VALUE_DEFINE (Uinteger);
64.27 +ATTRIBUTE_VALUE_DEFINE_WITH_NAME (uint64_t, Uinteger);
64.28 ATTRIBUTE_ACCESSOR_DEFINE (Uinteger);
64.29
64.30 template <typename T>
65.1 --- a/src/core/wscript Mon Apr 14 16:19:17 2008 -0700
65.2 +++ b/src/core/wscript Thu Apr 17 13:42:25 2008 -0700
65.3 @@ -46,15 +46,15 @@
65.4 'type-traits-test.cc',
65.5 'attribute.cc',
65.6 'boolean.cc',
65.7 - 'attribute-test.cc',
65.8 'integer.cc',
65.9 'uinteger.cc',
65.10 'enum.cc',
65.11 'double.cc',
65.12 'string.cc',
65.13 'pointer.cc',
65.14 + 'object-vector.cc',
65.15 + 'attribute-test.cc',
65.16 'object-factory.cc',
65.17 - 'object-vector.cc',
65.18 'global-value.cc',
65.19 'traced-callback.cc',
65.20 'trace-source-accessor.cc',
66.1 --- a/src/devices/csma/csma-channel.cc Mon Apr 14 16:19:17 2008 -0700
66.2 +++ b/src/devices/csma/csma-channel.cc Thu Apr 17 13:42:25 2008 -0700
66.3 @@ -53,11 +53,11 @@
66.4 .SetParent<Channel> ()
66.5 .AddConstructor<CsmaChannel> ()
66.6 .AddAttribute ("BitRate", "The maximum bitrate of the channel",
66.7 - DataRate (0xffffffff),
66.8 + DataRateValue (DataRate (0xffffffff)),
66.9 MakeDataRateAccessor (&CsmaChannel::m_bps),
66.10 MakeDataRateChecker ())
66.11 .AddAttribute ("Delay", "Transmission delay through the channel",
66.12 - Seconds (0),
66.13 + TimeValue (Seconds (0)),
66.14 MakeTimeAccessor (&CsmaChannel::m_delay),
66.15 MakeTimeChecker ())
66.16 ;
67.1 --- a/src/devices/csma/csma-net-device.cc Mon Apr 14 16:19:17 2008 -0700
67.2 +++ b/src/devices/csma/csma-net-device.cc Thu Apr 17 13:42:25 2008 -0700
67.3 @@ -46,34 +46,34 @@
67.4 .SetParent<NetDevice> ()
67.5 .AddConstructor<CsmaNetDevice> ()
67.6 .AddAttribute ("Address", "The address of this device.",
67.7 - Mac48Address ("ff:ff:ff:ff:ff:ff"),
67.8 + Mac48AddressValue (Mac48Address ("ff:ff:ff:ff:ff:ff")),
67.9 MakeMac48AddressAccessor (&CsmaNetDevice::m_address),
67.10 MakeMac48AddressChecker ())
67.11 .AddAttribute ("EncapsulationMode", "The mode of link-layer encapsulation to use.",
67.12 - Enum (LLC),
67.13 + EnumValue (LLC),
67.14 MakeEnumAccessor (&CsmaNetDevice::m_encapMode),
67.15 MakeEnumChecker (ETHERNET_V1, "EthernetV1",
67.16 IP_ARP, "IpArp",
67.17 RAW, "Raw",
67.18 LLC, "Llc"))
67.19 .AddAttribute ("SendEnable", "should tx be enabled ?",
67.20 - Boolean (true),
67.21 + BooleanValue (true),
67.22 MakeBooleanAccessor (&CsmaNetDevice::m_sendEnable),
67.23 MakeBooleanChecker ())
67.24 .AddAttribute ("ReceiveEnable", "should rx be enabled ?",
67.25 - Boolean (true),
67.26 + BooleanValue (true),
67.27 MakeBooleanAccessor (&CsmaNetDevice::m_receiveEnable),
67.28 MakeBooleanChecker ())
67.29 .AddAttribute ("DataRate", "XXX",
67.30 - DataRate (0xffffffff),
67.31 + DataRateValue (DataRate (0xffffffff)),
67.32 MakeDataRateAccessor (&CsmaNetDevice::m_bps),
67.33 MakeDataRateChecker ())
67.34 .AddAttribute ("RxErrorModel", "XXX",
67.35 - Pointer (),
67.36 + PointerValue (),
67.37 MakePointerAccessor (&CsmaNetDevice::m_receiveErrorModel),
67.38 MakePointerChecker<ErrorModel> ())
67.39 .AddAttribute ("TxQueue", "XXX",
67.40 - Pointer (),
67.41 + PointerValue (),
67.42 MakePointerAccessor (&CsmaNetDevice::m_queue),
67.43 MakePointerChecker<Queue> ())
67.44 .AddTraceSource ("Rx", "Receive MAC packet.",
68.1 --- a/src/devices/point-to-point/point-to-point-channel.cc Mon Apr 14 16:19:17 2008 -0700
68.2 +++ b/src/devices/point-to-point/point-to-point-channel.cc Thu Apr 17 13:42:25 2008 -0700
68.3 @@ -37,11 +37,11 @@
68.4 .SetParent<Channel> ()
68.5 .AddConstructor<PointToPointChannel> ()
68.6 .AddAttribute ("BitRate", "The maximum bitrate of the channel",
68.7 - DataRate (0xffffffff),
68.8 + DataRateValue (DataRate (0xffffffff)),
68.9 MakeDataRateAccessor (&PointToPointChannel::m_bps),
68.10 MakeDataRateChecker ())
68.11 .AddAttribute ("Delay", "Transmission delay through the channel",
68.12 - Seconds (0),
68.13 + TimeValue (Seconds (0)),
68.14 MakeTimeAccessor (&PointToPointChannel::m_delay),
68.15 MakeTimeChecker ())
68.16 ;
69.1 --- a/src/devices/point-to-point/point-to-point-net-device.cc Mon Apr 14 16:19:17 2008 -0700
69.2 +++ b/src/devices/point-to-point/point-to-point-net-device.cc Thu Apr 17 13:42:25 2008 -0700
69.3 @@ -43,23 +43,23 @@
69.4 .SetParent<NetDevice> ()
69.5 .AddConstructor<PointToPointNetDevice> ()
69.6 .AddAttribute ("Address", "The address of this device.",
69.7 - Mac48Address ("ff:ff:ff:ff:ff:ff"),
69.8 + Mac48AddressValue (Mac48Address ("ff:ff:ff:ff:ff:ff")),
69.9 MakeMac48AddressAccessor (&PointToPointNetDevice::m_address),
69.10 MakeMac48AddressChecker ())
69.11 .AddAttribute ("DataRate", "The default data rate for point to point links",
69.12 - DataRate ("10Mb/s"),
69.13 + DataRateValue (DataRate ("10Mb/s")),
69.14 MakeDataRateAccessor (&PointToPointNetDevice::m_bps),
69.15 MakeDataRateChecker ())
69.16 .AddAttribute ("ReceiveErrorModel", "XXX",
69.17 - Pointer (),
69.18 + PointerValue (),
69.19 MakePointerAccessor (&PointToPointNetDevice::m_receiveErrorModel),
69.20 MakePointerChecker<ErrorModel> ())
69.21 .AddAttribute ("TxQueue", "XXX",
69.22 - Pointer (),
69.23 + PointerValue (),
69.24 MakePointerAccessor (&PointToPointNetDevice::m_queue),
69.25 MakePointerChecker<Queue> ())
69.26 .AddAttribute ("InterframeGap", "XXX",
69.27 - Seconds (0.0),
69.28 + TimeValue (Seconds (0.0)),
69.29 MakeTimeAccessor (&PointToPointNetDevice::m_tInterframeGap),
69.30 MakeTimeChecker ())
69.31 .AddTraceSource ("Rx", "Receive MAC packet.",
70.1 --- a/src/devices/wifi/aarf-wifi-manager.cc Mon Apr 14 16:19:17 2008 -0700
70.2 +++ b/src/devices/wifi/aarf-wifi-manager.cc Thu Apr 17 13:42:25 2008 -0700
70.3 @@ -37,27 +37,27 @@
70.4 .SetParent<ArfWifiManager> ()
70.5 .AddConstructor<AarfWifiManager> ()
70.6 .AddAttribute ("SuccessK", "Multiplication factor for the success threshold in the AARF algorithm.",
70.7 - Double (2.0),
70.8 + DoubleValue (2.0),
70.9 MakeDoubleAccessor (&AarfWifiManager::m_successK),
70.10 MakeDoubleChecker<double> ())
70.11 .AddAttribute ("TimerK",
70.12 "Multiplication factor for the timer threshold in the AARF algorithm.",
70.13 - Double (2.0),
70.14 + DoubleValue (2.0),
70.15 MakeDoubleAccessor (&AarfWifiManager::m_timerK),
70.16 MakeDoubleChecker<double> ())
70.17 .AddAttribute ("MaxSuccessThreshold",
70.18 "Maximum value of the success threshold in the AARF algorithm.",
70.19 - Uinteger (60),
70.20 + UintegerValue (60),
70.21 MakeUintegerAccessor (&AarfWifiManager::m_maxSuccessThreshold),
70.22 MakeUintegerChecker<uint32_t> ())
70.23 .AddAttribute ("MinTimerThreshold",
70.24 "The minimum value for the 'timer' threshold in the AARF algorithm.",
70.25 - Uinteger (15),
70.26 + UintegerValue (15),
70.27 MakeUintegerAccessor (&AarfWifiManager::m_minTimerThreshold),
70.28 MakeUintegerChecker<uint32_t> ())
70.29 .AddAttribute ("MinSuccessThreshold",
70.30 "The minimum value for the success threshold in the AARF algorithm.",
70.31 - Uinteger (10),
70.32 + UintegerValue (10),
70.33 MakeUintegerAccessor (&AarfWifiManager::m_minSuccessThreshold),
70.34 MakeUintegerChecker<uint32_t> ())
70.35 ;
71.1 --- a/src/devices/wifi/amrr-wifi-manager.cc Mon Apr 14 16:19:17 2008 -0700
71.2 +++ b/src/devices/wifi/amrr-wifi-manager.cc Thu Apr 17 13:42:25 2008 -0700
71.3 @@ -38,27 +38,27 @@
71.4 .AddConstructor<AmrrWifiManager> ()
71.5 .AddAttribute ("UpdatePeriod",
71.6 "The interval between decisions about rate control changes",
71.7 - Seconds (1.0),
71.8 + TimeValue (Seconds (1.0)),
71.9 MakeTimeAccessor (&AmrrWifiManager::m_updatePeriod),
71.10 MakeTimeChecker ())
71.11 .AddAttribute ("FailureRatio",
71.12 "Ratio of minimum erronous transmissions needed to switch to a lower rate",
71.13 - Double (1.0/3.0),
71.14 + DoubleValue (1.0/3.0),
71.15 MakeDoubleAccessor (&AmrrWifiManager::m_failureRatio),
71.16 MakeDoubleChecker<double> (0.0, 1.0))
71.17 .AddAttribute ("SuccessRatio",
71.18 "Ratio of maximum erronous transmissions needed to switch to a higher rate",
71.19 - Double (1.0/10.0),
71.20 + DoubleValue (1.0/10.0),
71.21 MakeDoubleAccessor (&AmrrWifiManager::m_successRatio),
71.22 MakeDoubleChecker<double> (0.0, 1.0))
71.23 .AddAttribute ("MaxSuccessThreshold",
71.24 "Maximum number of consecutive success periods needed to switch to a higher rate",
71.25 - Uinteger (10),
71.26 + UintegerValue (10),
71.27 MakeUintegerAccessor (&AmrrWifiManager::m_maxSuccessThreshold),
71.28 MakeUintegerChecker<uint32_t> ())
71.29 .AddAttribute ("MinSuccessThreshold",
71.30 "Minimum number of consecutive success periods needed to switch to a higher rate",
71.31 - Uinteger (1),
71.32 + UintegerValue (1),
71.33 MakeUintegerAccessor (&AmrrWifiManager::m_minSuccessThreshold),
71.34 MakeUintegerChecker<uint32_t> ())
71.35 ;
72.1 --- a/src/devices/wifi/arf-wifi-manager.cc Mon Apr 14 16:19:17 2008 -0700
72.2 +++ b/src/devices/wifi/arf-wifi-manager.cc Thu Apr 17 13:42:25 2008 -0700
72.3 @@ -228,12 +228,12 @@
72.4 .SetParent<WifiRemoteStationManager> ()
72.5 .AddConstructor<ArfWifiManager> ()
72.6 .AddAttribute ("TimerThreshold", "The 'timer' threshold in the ARF algorithm.",
72.7 - Uinteger (15),
72.8 + UintegerValue (15),
72.9 MakeUintegerAccessor (&ArfWifiManager::m_timerThreshold),
72.10 MakeUintegerChecker<uint32_t> ())
72.11 .AddAttribute ("SuccessThreshold",
72.12 "The minimum number of sucessfull transmissions to try a new rate.",
72.13 - Uinteger (10),
72.14 + UintegerValue (10),
72.15 MakeUintegerAccessor (&ArfWifiManager::m_successThreshold),
72.16 MakeUintegerChecker<uint32_t> ())
72.17 ;
73.1 --- a/src/devices/wifi/constant-rate-wifi-manager.cc Mon Apr 14 16:19:17 2008 -0700
73.2 +++ b/src/devices/wifi/constant-rate-wifi-manager.cc Thu Apr 17 13:42:25 2008 -0700
73.3 @@ -78,11 +78,11 @@
73.4 .SetParent<WifiRemoteStationManager> ()
73.5 .AddConstructor<ConstantRateWifiManager> ()
73.6 .AddAttribute ("DataMode", "XXX",
73.7 - String ("wifia-6mbs"),
73.8 + StringValue ("wifia-6mbs"),
73.9 MakeWifiModeAccessor (&ConstantRateWifiManager::m_dataMode),
73.10 MakeWifiModeChecker ())
73.11 .AddAttribute ("ControlMode", "XXX",
73.12 - String ("wifia-6mbs"),
73.13 + StringValue ("wifia-6mbs"),
73.14 MakeWifiModeAccessor (&ConstantRateWifiManager::m_ctlMode),
73.15 MakeWifiModeChecker ())
73.16 ;
74.1 --- a/src/devices/wifi/dca-txop.cc Mon Apr 14 16:19:17 2008 -0700
74.2 +++ b/src/devices/wifi/dca-txop.cc Thu Apr 17 13:42:25 2008 -0700
74.3 @@ -100,17 +100,17 @@
74.4 .SetParent<Object> ()
74.5 .AddConstructor<DcaTxop> ()
74.6 .AddAttribute ("MinCw", "XXX",
74.7 - Uinteger (15),
74.8 + UintegerValue (15),
74.9 MakeUintegerAccessor (&DcaTxop::SetMinCw,
74.10 &DcaTxop::GetMinCw),
74.11 MakeUintegerChecker<uint32_t> ())
74.12 .AddAttribute ("MaxCw", "XXX",
74.13 - Uinteger (1023),
74.14 + UintegerValue (1023),
74.15 MakeUintegerAccessor (&DcaTxop::SetMaxCw,
74.16 &DcaTxop::GetMaxCw),
74.17 MakeUintegerChecker<uint32_t> ())
74.18 .AddAttribute ("Aifsn", "XXX",
74.19 - Uinteger (2),
74.20 + UintegerValue (2),
74.21 MakeUintegerAccessor (&DcaTxop::SetAifsn,
74.22 &DcaTxop::GetAifsn),
74.23 MakeUintegerChecker<uint32_t> ())
75.1 --- a/src/devices/wifi/ideal-wifi-manager.cc Mon Apr 14 16:19:17 2008 -0700
75.2 +++ b/src/devices/wifi/ideal-wifi-manager.cc Thu Apr 17 13:42:25 2008 -0700
75.3 @@ -46,7 +46,7 @@
75.4 .AddConstructor<IdealWifiManager> ()
75.5 .AddAttribute ("BerThreshold",
75.6 "The maximum Bit Error Rate acceptable at any transmission mode",
75.7 - Double (10e-6),
75.8 + DoubleValue (10e-6),
75.9 MakeDoubleAccessor (&IdealWifiManager::m_ber),
75.10 MakeDoubleChecker<double> ())
75.11 ;
76.1 --- a/src/devices/wifi/jakes-propagation-loss-model.cc Mon Apr 14 16:19:17 2008 -0700
76.2 +++ b/src/devices/wifi/jakes-propagation-loss-model.cc Thu Apr 17 13:42:25 2008 -0700
76.3 @@ -131,22 +131,22 @@
76.4 .AddConstructor<JakesPropagationLossModel> ()
76.5 .AddAttribute ("NumberOfRaysPerPath",
76.6 "The number of rays to use by default for compute the fading coeficent for a given path (default is 1)",
76.7 - Uinteger (1),
76.8 + UintegerValue (1),
76.9 MakeUintegerAccessor (&JakesPropagationLossModel::m_nRays),
76.10 MakeUintegerChecker<uint8_t> ())
76.11 .AddAttribute ("NumberOfOscillatorsPerRay",
76.12 "The number of oscillators to use by default for compute the coeficent for a given ray of a given path (default is 4)",
76.13 - Uinteger (4),
76.14 + UintegerValue (4),
76.15 MakeUintegerAccessor (&JakesPropagationLossModel::m_nOscillators),
76.16 MakeUintegerChecker<uint8_t> ())
76.17 .AddAttribute ("DopplerFreq",
76.18 "The doppler frequency in Hz (f_d = v / lambda = v * f / c, the defualt is 0)",
76.19 - Double(0.0),
76.20 + DoubleValue (0.0),
76.21 MakeDoubleAccessor (&JakesPropagationLossModel::m_fd),
76.22 MakeDoubleChecker<double> ())
76.23 .AddAttribute ("Distribution",
76.24 "The distribution to choose the initial phases.",
76.25 - ConstantVariable (1.0),
76.26 + RandomVariableValue (ConstantVariable (1.0)),
76.27 MakeRandomVariableAccessor (&JakesPropagationLossModel::m_variable),
76.28 MakeRandomVariableChecker ())
76.29 ;
77.1 --- a/src/devices/wifi/nqap-wifi-mac.cc Mon Apr 14 16:19:17 2008 -0700
77.2 +++ b/src/devices/wifi/nqap-wifi-mac.cc Thu Apr 17 13:42:25 2008 -0700
77.3 @@ -47,11 +47,11 @@
77.4 .SetParent<WifiMac> ()
77.5 .AddConstructor<NqapWifiMac> ()
77.6 .AddAttribute ("BeaconInterval", "Delay between two beacons",
77.7 - Seconds (1.0),
77.8 + TimeValue (Seconds (1.0)),
77.9 MakeTimeAccessor (&NqapWifiMac::m_beaconInterval),
77.10 MakeTimeChecker ())
77.11 .AddAttribute ("BeaconGeneration", "Whether or not beacons are generated.",
77.12 - Boolean (false),
77.13 + BooleanValue (false),
77.14 MakeBooleanAccessor (&NqapWifiMac::SetBeaconGeneration,
77.15 &NqapWifiMac::GetBeaconGeneration),
77.16 MakeBooleanChecker ())
78.1 --- a/src/devices/wifi/nqsta-wifi-mac.cc Mon Apr 14 16:19:17 2008 -0700
78.2 +++ b/src/devices/wifi/nqsta-wifi-mac.cc Thu Apr 17 13:42:25 2008 -0700
78.3 @@ -66,21 +66,21 @@
78.4 .SetParent<WifiMac> ()
78.5 .AddConstructor<NqstaWifiMac> ()
78.6 .AddAttribute ("ProbeRequestTimeout", "XXX",
78.7 - Seconds (0.5),
78.8 + TimeValue (Seconds (0.5)),
78.9 MakeTimeAccessor (&NqstaWifiMac::m_probeRequestTimeout),
78.10 MakeTimeChecker ())
78.11 .AddAttribute ("AssocRequestTimeout", "XXX",
78.12 - Seconds (0.5),
78.13 + TimeValue (Seconds (0.5)),
78.14 MakeTimeAccessor (&NqstaWifiMac::m_assocRequestTimeout),
78.15 MakeTimeChecker ())
78.16 .AddAttribute ("MaxMissedBeacons",
78.17 "Number of beacons which much be consecutively missed before "
78.18 "we attempt to restart association.",
78.19 - Uinteger (10),
78.20 + UintegerValue (10),
78.21 MakeUintegerAccessor (&NqstaWifiMac::m_maxMissedBeacons),
78.22 MakeUintegerChecker<uint32_t> ())
78.23 .AddAttribute ("ActiveProbing", "XXX",
78.24 - Boolean (false),
78.25 + BooleanValue (false),
78.26 MakeBooleanAccessor (&NqstaWifiMac::SetActiveProbing),
78.27 MakeBooleanChecker ())
78.28 ;
79.1 --- a/src/devices/wifi/onoe-wifi-manager.cc Mon Apr 14 16:19:17 2008 -0700
79.2 +++ b/src/devices/wifi/onoe-wifi-manager.cc Thu Apr 17 13:42:25 2008 -0700
79.3 @@ -37,15 +37,15 @@
79.4 .AddConstructor<OnoeWifiManager> ()
79.5 .AddAttribute ("UpdatePeriod",
79.6 "The interval between decisions about rate control changes",
79.7 - Seconds (1.0),
79.8 + TimeValue (Seconds (1.0)),
79.9 MakeTimeAccessor (&OnoeWifiManager::m_updatePeriod),
79.10 MakeTimeChecker ())
79.11 .AddAttribute ("RaiseThreshold", "XXX",
79.12 - Uinteger (10),
79.13 + UintegerValue (10),
79.14 MakeUintegerAccessor (&OnoeWifiManager::m_raiseThreshold),
79.15 MakeUintegerChecker<uint32_t> ())
79.16 .AddAttribute ("AddCreditThreshold", "Add credit threshold",
79.17 - Uinteger (10),
79.18 + UintegerValue (10),
79.19 MakeUintegerAccessor (&OnoeWifiManager::m_addCreditThreshold),
79.20 MakeUintegerChecker<uint32_t> ())
79.21 ;
80.1 --- a/src/devices/wifi/propagation-delay-model.cc Mon Apr 14 16:19:17 2008 -0700
80.2 +++ b/src/devices/wifi/propagation-delay-model.cc Thu Apr 17 13:42:25 2008 -0700
80.3 @@ -48,7 +48,7 @@
80.4 .AddConstructor<RandomPropagationDelayModel> ()
80.5 .AddAttribute ("Variable",
80.6 "The random variable which generates random delays (s).",
80.7 - UniformVariable (0.0, 1.0),
80.8 + RandomVariableValue (UniformVariable (0.0, 1.0)),
80.9 MakeRandomVariableAccessor (&RandomPropagationDelayModel::m_variable),
80.10 MakeRandomVariableChecker ())
80.11 ;
80.12 @@ -74,7 +74,7 @@
80.13 .SetParent<PropagationDelayModel> ()
80.14 .AddConstructor<ConstantSpeedPropagationDelayModel> ()
80.15 .AddAttribute ("Speed", "The speed (m/s)",
80.16 - Double (300000000.0),
80.17 + DoubleValue (300000000.0),
80.18 MakeDoubleAccessor (&ConstantSpeedPropagationDelayModel::m_speed),
80.19 MakeDoubleChecker<double> ())
80.20 ;
81.1 --- a/src/devices/wifi/propagation-loss-model.cc Mon Apr 14 16:19:17 2008 -0700
81.2 +++ b/src/devices/wifi/propagation-loss-model.cc Thu Apr 17 13:42:25 2008 -0700
81.3 @@ -56,7 +56,7 @@
81.4 .SetParent<PropagationLossModel> ()
81.5 .AddConstructor<RandomPropagationLossModel> ()
81.6 .AddAttribute ("Variable", "XXX",
81.7 - ConstantVariable (1.0),
81.8 + RandomVariableValue (ConstantVariable (1.0)),
81.9 MakeRandomVariableAccessor (&RandomPropagationLossModel::m_variable),
81.10 MakeRandomVariableChecker ())
81.11 ;
81.12 @@ -87,16 +87,16 @@
81.13 .AddConstructor<FriisPropagationLossModel> ()
81.14 .AddAttribute ("Lambda",
81.15 "The wavelength (default is 5.15 GHz at 300 000 km/s).",
81.16 - Double (300000000.0 / 5.150e9),
81.17 + DoubleValue (300000000.0 / 5.150e9),
81.18 MakeDoubleAccessor (&FriisPropagationLossModel::m_lambda),
81.19 MakeDoubleChecker<double> ())
81.20 .AddAttribute ("SystemLoss", "The system loss",
81.21 - Double (1.0),
81.22 + DoubleValue (1.0),
81.23 MakeDoubleAccessor (&FriisPropagationLossModel::m_systemLoss),
81.24 MakeDoubleChecker<double> ())
81.25 .AddAttribute ("MinDistance",
81.26 "The distance under which the propagation model refuses to give results (m)",
81.27 - Double (0.5),
81.28 + DoubleValue (0.5),
81.29 MakeDoubleAccessor (&FriisPropagationLossModel::m_minDistance),
81.30 MakeDoubleChecker<double> ())
81.31 ;
81.32 @@ -201,17 +201,17 @@
81.33 .AddConstructor<LogDistancePropagationLossModel> ()
81.34 .AddAttribute ("Exponent",
81.35 "The exponent of the Path Loss propagation model",
81.36 - Double (3.0),
81.37 + DoubleValue (3.0),
81.38 MakeDoubleAccessor (&LogDistancePropagationLossModel::m_exponent),
81.39 MakeDoubleChecker<double> ())
81.40 .AddAttribute ("ReferenceDistance",
81.41 "The distance at which the reference loss is calculated (m)",
81.42 - Double (1.0),
81.43 + DoubleValue (1.0),
81.44 MakeDoubleAccessor (&LogDistancePropagationLossModel::m_referenceDistance),
81.45 MakeDoubleChecker<double> ())
81.46 .AddAttribute ("ReferenceModel",
81.47 "The reference model at the reference distance.",
81.48 - Pointer (),
81.49 + PointerValue (),
81.50 MakePointerAccessor (&LogDistancePropagationLossModel::m_reference),
81.51 MakePointerChecker<PropagationLossModel> ())
81.52 ;
81.53 @@ -268,10 +268,10 @@
81.54 */
81.55 static Ptr<StaticMobilityModel> zero =
81.56 CreateObject<StaticMobilityModel> ("Position",
81.57 - Vector (0.0, 0.0, 0.0));
81.58 + VectorValue (Vector (0.0, 0.0, 0.0)));
81.59 static Ptr<StaticMobilityModel> reference =
81.60 CreateObject<StaticMobilityModel> ("Position",
81.61 - Vector (m_referenceDistance, 0.0, 0.0));
81.62 + VectorValue (Vector (m_referenceDistance, 0.0, 0.0)));
81.63 double ref = m_reference->GetLoss (zero, reference);
81.64 double pathLossDb = 10 * m_exponent * log10 (distance / m_referenceDistance);
81.65 double rxc = ref - pathLossDb;
82.1 --- a/src/devices/wifi/rraa-wifi-manager.cc Mon Apr 14 16:19:17 2008 -0700
82.2 +++ b/src/devices/wifi/rraa-wifi-manager.cc Thu Apr 17 13:42:25 2008 -0700
82.3 @@ -193,122 +193,122 @@
82.4 .AddConstructor<RraaWifiManager> ()
82.5 .AddAttribute ("Basic",
82.6 "If true the RRAA-BASIC algorithm will be used, otherwise the RRAA wil be used",
82.7 - Boolean (false),
82.8 + BooleanValue (false),
82.9 MakeBooleanAccessor (&RraaWifiManager::m_basic),
82.10 MakeBooleanChecker ())
82.11 .AddAttribute ("Timeout",
82.12 "Timeout for the RRAA BASIC loss estimaton block (s)",
82.13 - Seconds (0.05),
82.14 + TimeValue (Seconds (0.05)),
82.15 MakeTimeAccessor (&RraaWifiManager::m_timeout),
82.16 MakeTimeChecker ())
82.17 .AddAttribute ("ewndFor54mbps",
82.18 "ewnd parameter for 54 Mbs data mode",
82.19 - Uinteger (40),
82.20 + UintegerValue (40),
82.21 MakeUintegerAccessor (&RraaWifiManager::m_ewndfor54),
82.22 MakeUintegerChecker<uint32_t> ())
82.23 .AddAttribute ("ewndFor48mbps",
82.24 "ewnd parameter for 48 Mbs data mode",
82.25 - Uinteger (40),
82.26 + UintegerValue (40),
82.27 MakeUintegerAccessor (&RraaWifiManager::m_ewndfor48),
82.28 MakeUintegerChecker<uint32_t> ())
82.29 .AddAttribute ("ewndFor36mbps",
82.30 "ewnd parameter for 36 Mbs data mode",
82.31 - Uinteger (40),
82.32 + UintegerValue (40),
82.33 MakeUintegerAccessor (&RraaWifiManager::m_ewndfor36),
82.34 MakeUintegerChecker<uint32_t> ())
82.35 .AddAttribute ("ewndFor24mbps",
82.36 "ewnd parameter for 24 Mbs data mode",
82.37 - Uinteger (40),
82.38 + UintegerValue (40),
82.39 MakeUintegerAccessor (&RraaWifiManager::m_ewndfor24),
82.40 MakeUintegerChecker<uint32_t> ())
82.41 .AddAttribute ("ewndFor18mbps",
82.42 "ewnd parameter for 18 Mbs data mode",
82.43 - Uinteger (20),
82.44 + UintegerValue (20),
82.45 MakeUintegerAccessor (&RraaWifiManager::m_ewndfor18),
82.46 MakeUintegerChecker<uint32_t> ())
82.47 .AddAttribute ("ewndFor12mbps",
82.48 "ewnd parameter for 12 Mbs data mode",
82.49 - Uinteger (20),
82.50 + UintegerValue (20),
82.51 MakeUintegerAccessor (&RraaWifiManager::m_ewndfor12),
82.52 MakeUintegerChecker<uint32_t> ())
82.53 .AddAttribute ("ewndFor9mbps",
82.54 "ewnd parameter for 9 Mbs data mode",
82.55 - Uinteger (10),
82.56 + UintegerValue (10),
82.57 MakeUintegerAccessor (&RraaWifiManager::m_ewndfor9),
82.58 MakeUintegerChecker<uint32_t> ())
82.59 .AddAttribute ("ewndFor6mbps",
82.60 "ewnd parameter for 6 Mbs data mode",
82.61 - Uinteger (6),
82.62 + UintegerValue (6),
82.63 MakeUintegerAccessor (&RraaWifiManager::m_ewndfor6),
82.64 MakeUintegerChecker<uint32_t> ())
82.65 .AddAttribute ("poriFor48mbps",
82.66 "Pori parameter for 48 Mbs data mode",
82.67 - Double (0.047),
82.68 + DoubleValue (0.047),
82.69 MakeDoubleAccessor (&RraaWifiManager::m_porifor48),
82.70 MakeDoubleChecker<double> ())
82.71 .AddAttribute ("poriFor36mbps",
82.72 "Pori parameter for 36 Mbs data mode",
82.73 - Double (0.115),
82.74 + DoubleValue (0.115),
82.75 MakeDoubleAccessor (&RraaWifiManager::m_porifor36),
82.76 MakeDoubleChecker<double> ())
82.77 .AddAttribute ("poriFor24mbps",
82.78 "Pori parameter for 24 Mbs data mode",
82.79 - Double (0.1681),
82.80 + DoubleValue (0.1681),
82.81 MakeDoubleAccessor (&RraaWifiManager::m_porifor24),
82.82 MakeDoubleChecker<double> ())
82.83 .AddAttribute ("poriFor18mbps",
82.84 "Pori parameter for 18 Mbs data mode",
82.85 - Double (0.1325),
82.86 + DoubleValue (0.1325),
82.87 MakeDoubleAccessor (&RraaWifiManager::m_porifor18),
82.88 MakeDoubleChecker<double> ())
82.89 .AddAttribute ("poriFor12mbps",
82.90 "Pori parameter for 12 Mbs data mode",
82.91 - Double (0.1861),
82.92 + DoubleValue (0.1861),
82.93 MakeDoubleAccessor (&RraaWifiManager::m_porifor12),
82.94 MakeDoubleChecker<double> ())
82.95 .AddAttribute ("poriFor9mbps",
82.96 "Pori parameter for 9 Mbs data mode",
82.97 - Double (0.1434),
82.98 + DoubleValue (0.1434),
82.99 MakeDoubleAccessor (&RraaWifiManager::m_porifor9),
82.100 MakeDoubleChecker<double> ())
82.101 .AddAttribute ("poriFor6mbps",
82.102 "Pori parameter for 6 Mbs data mode",
82.103 - Double (0.5),
82.104 + DoubleValue (0.5),
82.105 MakeDoubleAccessor (&RraaWifiManager::m_porifor6),
82.106 MakeDoubleChecker<double> ())
82.107 .AddAttribute ("pmtlFor54mbps",
82.108 "Pmtl parameter for 54 Mbs data mode",
82.109 - Double (0.094),
82.110 + DoubleValue (0.094),
82.111 MakeDoubleAccessor (&RraaWifiManager::m_pmtlfor54),
82.112 MakeDoubleChecker<double> ())
82.113 .AddAttribute ("pmtlFor48mbps",
82.114 "Pmtl parameter for 48 Mbs data mode",
82.115 - Double (0.23),
82.116 + DoubleValue (0.23),
82.117 MakeDoubleAccessor (&RraaWifiManager::m_pmtlfor48),
82.118 MakeDoubleChecker<double> ())
82.119 .AddAttribute ("pmtlFor36mbps",
82.120 "Pmtl parameter for 36 Mbs data mode",
82.121 - Double (0.3363),
82.122 + DoubleValue (0.3363),
82.123 MakeDoubleAccessor (&RraaWifiManager::m_pmtlfor36),
82.124 MakeDoubleChecker<double> ())
82.125 .AddAttribute ("pmtlFor24mbps",
82.126 "Pmtl parameter for 24 Mbs data mode",
82.127 - Double (0.265),
82.128 + DoubleValue (0.265),
82.129 MakeDoubleAccessor (&RraaWifiManager::m_pmtlfor24),
82.130 MakeDoubleChecker<double> ())
82.131 .AddAttribute ("pmtlFor18mbps",
82.132 "Pmtl parameter for 18 Mbs data mode",
82.133 - Double (0.3722),
82.134 + DoubleValue (0.3722),
82.135 MakeDoubleAccessor (&RraaWifiManager::m_pmtlfor18),
82.136 MakeDoubleChecker<double> ())
82.137 .AddAttribute ("pmtlFor12mbps",
82.138 "Pmtl parameter for 12 Mbs data mode",
82.139 - Double(0.2868),
82.140 + DoubleValue (0.2868),
82.141 MakeDoubleAccessor (&RraaWifiManager::m_pmtlfor12),
82.142 MakeDoubleChecker<double> ())
82.143 .AddAttribute ("pmtlFor9mbps",
82.144 "Pmtl parameter for 9 Mbs data mode",
82.145 - Double (0.3932),
82.146 + DoubleValue (0.3932),
82.147 MakeDoubleAccessor (&RraaWifiManager::m_pmtlfor9),
82.148 MakeDoubleChecker<double> ())
82.149 ;
83.1 --- a/src/devices/wifi/wifi-channel.cc Mon Apr 14 16:19:17 2008 -0700
83.2 +++ b/src/devices/wifi/wifi-channel.cc Thu Apr 17 13:42:25 2008 -0700
83.3 @@ -39,11 +39,11 @@
83.4 .SetParent<Channel> ()
83.5 .AddConstructor<WifiChannel> ()
83.6 .AddAttribute ("PropagationLossModel", "XXX",
83.7 - Pointer (),
83.8 + PointerValue (),
83.9 MakePointerAccessor (&WifiChannel::m_loss),
83.10 MakePointerChecker<PropagationLossModel> ())
83.11 .AddAttribute ("PropagationDelayModel", "XXX",
83.12 - Pointer (),
83.13 + PointerValue (),
83.14 MakePointerAccessor (&WifiChannel::m_delay),
83.15 MakePointerChecker<PropagationDelayModel> ())
83.16 ;
84.1 --- a/src/devices/wifi/wifi-mac-queue.cc Mon Apr 14 16:19:17 2008 -0700
84.2 +++ b/src/devices/wifi/wifi-mac-queue.cc Thu Apr 17 13:42:25 2008 -0700
84.3 @@ -40,12 +40,12 @@
84.4 static TypeId tid = TypeId ("WifiMacQueue")
84.5 .SetParent<Object> ()
84.6 .AddConstructor<WifiMacQueue> ()
84.7 - .AddAttribute ("MaxPacketNumber", "XXX",
84.8 - Uinteger (400),
84.9 + .AddAttribute ("MaxPacketNumber", "If a packet arrives when there are already this number of packets, it is dropped.",
84.10 + UintegerValue (400),
84.11 MakeUintegerAccessor (&WifiMacQueue::m_maxSize),
84.12 MakeUintegerChecker<uint32_t> ())
84.13 - .AddAttribute ("MaxDelay", "XXX",
84.14 - Seconds (10.0),
84.15 + .AddAttribute ("MaxDelay", "If a packet stays longer than this delay in the queue, it is dropped.",
84.16 + TimeValue (Seconds (10.0)),
84.17 MakeTimeAccessor (&WifiMacQueue::m_maxDelay),
84.18 MakeTimeChecker ())
84.19 ;
85.1 --- a/src/devices/wifi/wifi-mac.cc Mon Apr 14 16:19:17 2008 -0700
85.2 +++ b/src/devices/wifi/wifi-mac.cc Thu Apr 17 13:42:25 2008 -0700
85.3 @@ -74,42 +74,42 @@
85.4 static TypeId tid = TypeId ("ns3::WifiMac")
85.5 .SetParent<Object> ()
85.6 .AddAttribute ("CtsTimeout", "XXX",
85.7 - GetDefaultCtsAckTimeout (),
85.8 + TimeValue (GetDefaultCtsAckTimeout ()),
85.9 MakeTimeAccessor (&WifiMac::m_ctsTimeout),
85.10 MakeTimeChecker ())
85.11 .AddAttribute ("AckTimeout", "XXX",
85.12 - GetDefaultCtsAckTimeout (),
85.13 + TimeValue (GetDefaultCtsAckTimeout ()),
85.14 MakeTimeAccessor (&WifiMac::m_ackTimeout),
85.15 MakeTimeChecker ())
85.16 .AddAttribute ("Sifs", "XXX",
85.17 - GetDefaultSifs (),
85.18 + TimeValue (GetDefaultSifs ()),
85.19 MakeTimeAccessor (&WifiMac::SetSifs,
85.20 &WifiMac::GetSifs),
85.21 MakeTimeChecker ())
85.22 .AddAttribute ("EifsNoDifs", "XXX",
85.23 - GetDefaultEifsNoDifs (),
85.24 + TimeValue (GetDefaultEifsNoDifs ()),
85.25 MakeTimeAccessor (&WifiMac::SetEifsNoDifs,
85.26 &WifiMac::GetEifsNoDifs),
85.27 MakeTimeChecker ())
85.28 .AddAttribute ("Slot", "XXX",
85.29 - GetDefaultSlot (),
85.30 + TimeValue (GetDefaultSlot ()),
85.31 MakeTimeAccessor (&WifiMac::SetSlot,
85.32 &WifiMac::GetSlot),
85.33 MakeTimeChecker ())
85.34 .AddAttribute ("Pifs", "XXX",
85.35 - GetDefaultSifs () + GetDefaultSlot (),
85.36 + TimeValue (GetDefaultSifs () + GetDefaultSlot ()),
85.37 MakeTimeAccessor (&WifiMac::m_pifs),
85.38 MakeTimeChecker ())
85.39 .AddAttribute ("MaxPropagationDelay", "XXX",
85.40 - GetDefaultMaxPropagationDelay (),
85.41 + TimeValue (GetDefaultMaxPropagationDelay ()),
85.42 MakeTimeAccessor (&WifiMac::m_maxPropagationDelay),
85.43 MakeTimeChecker ())
85.44 .AddAttribute ("MaxMsduSize", "XXX",
85.45 - Uinteger (2304),
85.46 + UintegerValue (2304),
85.47 MakeUintegerAccessor (&WifiMac::m_maxMsduSize),
85.48 MakeUintegerChecker<uint16_t> (1,2304))
85.49 .AddAttribute ("Ssid", "XXX",
85.50 - Ssid ("default"),
85.51 + SsidValue (Ssid ("default")),
85.52 MakeSsidAccessor (&WifiMac::GetSsid,
85.53 &WifiMac::SetSsid),
85.54 MakeSsidChecker ())
86.1 --- a/src/devices/wifi/wifi-net-device.cc Mon Apr 14 16:19:17 2008 -0700
86.2 +++ b/src/devices/wifi/wifi-net-device.cc Thu Apr 17 13:42:25 2008 -0700
86.3 @@ -39,22 +39,22 @@
86.4 static TypeId tid = TypeId ("ns3::WifiNetDevice")
86.5 .SetParent<NetDevice> ()
86.6 .AddAttribute ("Channel", "The channel attached to this device",
86.7 - Pointer (),
86.8 + PointerValue (),
86.9 MakePointerAccessor (&WifiNetDevice::DoGetChannel,
86.10 &WifiNetDevice::SetChannel),
86.11 MakePointerChecker<WifiChannel> ())
86.12 .AddAttribute ("Phy", "The PHY layer attached to this device.",
86.13 - Pointer (),
86.14 + PointerValue (),
86.15 MakePointerAccessor (&WifiNetDevice::GetPhy,
86.16 &WifiNetDevice::SetPhy),
86.17 MakePointerChecker<WifiPhy> ())
86.18 .AddAttribute ("Mac", "The MAC layer attached to this device.",
86.19 - Pointer (),
86.20 + PointerValue (),
86.21 MakePointerAccessor (&WifiNetDevice::GetMac,
86.22 &WifiNetDevice::SetMac),
86.23 MakePointerChecker<WifiMac> ())
86.24 .AddAttribute ("RemoteStationManager", "The station manager attached to this device.",
86.25 - Pointer (),
86.26 + PointerValue (),
86.27 MakePointerAccessor (&WifiNetDevice::SetRemoteStationManager,
86.28 &WifiNetDevice::GetRemoteStationManager),
86.29 MakePointerChecker<WifiRemoteStationManager> ())
86.30 @@ -207,8 +207,9 @@
86.31 bool
86.32 WifiNetDevice::SetMtu (const uint16_t mtu)
86.33 {
86.34 - Uinteger maxMsduSize = m_mac->GetAttribute ("MaxMsduSize");
86.35 - if (mtu > maxMsduSize && mtu > 0)
86.36 + UintegerValue maxMsduSize;
86.37 + m_mac->GetAttribute ("MaxMsduSize", maxMsduSize);
86.38 + if (mtu > maxMsduSize.Get () || mtu == 0)
86.39 {
86.40 return false;
86.41 }
86.42 @@ -220,8 +221,9 @@
86.43 {
86.44 if (m_mtu == 0)
86.45 {
86.46 - Uinteger maxMsduSize = m_mac->GetAttribute ("MaxMsduSize");
86.47 - m_mtu = maxMsduSize;
86.48 + UintegerValue maxMsduSize;
86.49 + m_mac->GetAttribute ("MaxMsduSize", maxMsduSize);
86.50 + m_mtu = maxMsduSize.Get ();
86.51 }
86.52 return m_mtu;
86.53 }
87.1 --- a/src/devices/wifi/wifi-phy.cc Mon Apr 14 16:19:17 2008 -0700
87.2 +++ b/src/devices/wifi/wifi-phy.cc Thu Apr 17 13:42:25 2008 -0700
87.3 @@ -187,48 +187,48 @@
87.4 .AddAttribute ("EnergyDetectionThreshold",
87.5 "The energy of a received signal should be higher than "
87.6 "this threshold (dbm) to allow the PHY layer to detect the signal.",
87.7 - Double (-140.0),
87.8 + DoubleValue (-140.0),
87.9 MakeDoubleAccessor (&WifiPhy::SetEdThreshold,
87.10 &WifiPhy::GetEdThreshold),
87.11 MakeDoubleChecker<double> ())
87.12 .AddAttribute ("TxGain",
87.13 "Transmission gain (dB).",
87.14 - Double (1.0),
87.15 + DoubleValue (1.0),
87.16 MakeDoubleAccessor (&WifiPhy::SetTxGain,
87.17 &WifiPhy::GetTxGain),
87.18 MakeDoubleChecker<double> ())
87.19 .AddAttribute ("RxGain",
87.20 "Reception gain (dB).",
87.21 - Double (1.0),
87.22 + DoubleValue (1.0),
87.23 MakeDoubleAccessor (&WifiPhy::SetRxGain,
87.24 &WifiPhy::GetRxGain),
87.25 MakeDoubleChecker<double> ())
87.26 .AddAttribute ("TxPowerLevels",
87.27 "Number of transmission power levels available between "
87.28 "TxPowerBase and TxPowerEnd included.",
87.29 - Uinteger (1),
87.30 + UintegerValue (1),
87.31 MakeUintegerAccessor (&WifiPhy::m_nTxPower),
87.32 MakeUintegerChecker<uint32_t> ())
87.33 .AddAttribute ("TxPowerEnd",
87.34 "Maximum available transmission level (dbm).",
87.35 - Double (16.0206),
87.36 + DoubleValue (16.0206),
87.37 MakeDoubleAccessor (&WifiPhy::SetTxPowerEnd,
87.38 &WifiPhy::GetTxPowerEnd),
87.39 MakeDoubleChecker<double> ())
87.40 .AddAttribute ("TxPowerStart",
87.41 "Minimum available transmission level (dbm).",
87.42 - Double (16.0206),
87.43 + DoubleValue (16.0206),
87.44 MakeDoubleAccessor (&WifiPhy::SetTxPowerStart,
87.45 &WifiPhy::GetTxPowerStart),
87.46 MakeDoubleChecker<double> ())
87.47 .AddAttribute ("RxNoise",
87.48 "Ratio of energy lost by receiver (dB).",
87.49 - Double (7),
87.50 + DoubleValue (7),
87.51 MakeDoubleAccessor (&WifiPhy::SetRxNoise,
87.52 &WifiPhy::GetRxNoise),
87.53 MakeDoubleChecker<double> ())
87.54 .AddAttribute ("Standard", "XXX",
87.55 - Enum (WIFI_PHY_STANDARD_80211a),
87.56 + EnumValue (WIFI_PHY_STANDARD_80211a),
87.57 MakeEnumAccessor (&WifiPhy::SetStandard),
87.58 MakeEnumChecker (WIFI_PHY_STANDARD_80211a, "802.11a",
87.59 WIFI_PHY_STANDARD_holland, "holland"))
88.1 --- a/src/devices/wifi/wifi-remote-station-manager.cc Mon Apr 14 16:19:17 2008 -0700
88.2 +++ b/src/devices/wifi/wifi-remote-station-manager.cc Thu Apr 17 13:42:25 2008 -0700
88.3 @@ -127,23 +127,23 @@
88.4 static TypeId tid = TypeId ("ns3::WifiRemoteStationManager")
88.5 .SetParent<Object> ()
88.6 .AddAttribute ("IsLowLatency", "XXX",
88.7 - Boolean (true),
88.8 + BooleanValue (true),
88.9 MakeBooleanAccessor (&WifiRemoteStationManager::m_isLowLatency),
88.10 MakeBooleanChecker ())
88.11 .AddAttribute ("MaxSsrc", "XXX",
88.12 - Uinteger (7),
88.13 + UintegerValue (7),
88.14 MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSsrc),
88.15 MakeUintegerChecker<uint32_t> ())
88.16 .AddAttribute ("MaxSlrc", "XXX",
88.17 - Uinteger (7),
88.18 + UintegerValue (7),
88.19 MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc),
88.20 MakeUintegerChecker<uint32_t> ())
88.21 .AddAttribute ("RtsCtsThreshold", "XXX",
88.22 - Uinteger (1500),
88.23 + UintegerValue (1500),
88.24 MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThreshold),
88.25 MakeUintegerChecker<uint32_t> ())
88.26 .AddAttribute ("FragmentationThreshold", "XXX",
88.27 - Uinteger (1500),
88.28 + UintegerValue (1500),
88.29 MakeUintegerAccessor (&WifiRemoteStationManager::m_fragmentationThreshold),
88.30 MakeUintegerChecker<uint32_t> ())
88.31 ;
89.1 --- a/src/helper/csma-helper.cc Mon Apr 14 16:19:17 2008 -0700
89.2 +++ b/src/helper/csma-helper.cc Thu Apr 17 13:42:25 2008 -0700
89.3 @@ -39,10 +39,10 @@
89.4
89.5 void
89.6 CsmaHelper::SetQueue (std::string type,
89.7 - std::string n1, Attribute v1,
89.8 - std::string n2, Attribute v2,
89.9 - std::string n3, Attribute v3,
89.10 - std::string n4, Attribute v4)
89.11 + std::string n1, const AttributeValue &v1,
89.12 + std::string n2, const AttributeValue &v2,
89.13 + std::string n3, const AttributeValue &v3,
89.14 + std::string n4, const AttributeValue &v4)
89.15 {
89.16 m_queueFactory.SetTypeId (type);
89.17 m_queueFactory.Set (n1, v1);
89.18 @@ -52,13 +52,13 @@
89.19 }
89.20
89.21 void
89.22 -CsmaHelper::SetDeviceParameter (std::string n1, Attribute v1)
89.23 +CsmaHelper::SetDeviceParameter (std::string n1, const AttributeValue &v1)
89.24 {
89.25 m_deviceFactory.Set (n1, v1);
89.26 }
89.27
89.28 void
89.29 -CsmaHelper::SetChannelParameter (std::string n1, Attribute v1)
89.30 +CsmaHelper::SetChannelParameter (std::string n1, const AttributeValue &v1)
89.31 {
89.32 m_channelFactory.Set (n1, v1);
89.33 }
90.1 --- a/src/helper/csma-helper.h Mon Apr 14 16:19:17 2008 -0700
90.2 +++ b/src/helper/csma-helper.h Thu Apr 17 13:42:25 2008 -0700
90.3 @@ -56,10 +56,10 @@
90.4 * CsmaNetDevice created through CsmaHelper::Install.
90.5 */
90.6 void SetQueue (std::string type,
90.7 - std::string n1 = "", Attribute v1 = Attribute (),
90.8 - std::string n2 = "", Attribute v2 = Attribute (),
90.9 - std::string n3 = "", Attribute v3 = Attribute (),
90.10 - std::string n4 = "", Attribute v4 = Attribute ());
90.11 + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
90.12 + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
90.13 + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
90.14 + std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue ());
90.15
90.16 /**
90.17 * \param n1 the name of the attribute to set
90.18 @@ -68,7 +68,7 @@
90.19 * Set these parameters on each ns3::CsmaNetDevice created
90.20 * by CsmaHelper::Install
90.21 */
90.22 - void SetDeviceParameter (std::string n1, Attribute v1);
90.23 + void SetDeviceParameter (std::string n1, const AttributeValue &v1);
90.24
90.25 /**
90.26 * \param n1 the name of the attribute to set
90.27 @@ -77,7 +77,7 @@
90.28 * Set these parameters on each ns3::CsmaChannel created
90.29 * by CsmaHelper::Install
90.30 */
90.31 - void SetChannelParameter (std::string n1, Attribute v1);
90.32 + void SetChannelParameter (std::string n1, const AttributeValue &v1);
90.33
90.34 /**
90.35 * \param filename filename prefix to use for pcap files.
91.1 --- a/src/helper/mobility-helper.cc Mon Apr 14 16:19:17 2008 -0700
91.2 +++ b/src/helper/mobility-helper.cc Thu Apr 17 13:42:25 2008 -0700
91.3 @@ -32,8 +32,9 @@
91.4 MobilityHelper::MobilityHelper ()
91.5 : m_notifierEnabled (false)
91.6 {
91.7 - m_position = CreateObject<RandomRectanglePositionAllocator> ("X", ConstantVariable (0.0),
91.8 - "Y", ConstantVariable (0.0));
91.9 + m_position = CreateObject<RandomRectanglePositionAllocator>
91.10 + ("X", RandomVariableValue (ConstantVariable (0.0)),
91.11 + "Y", RandomVariableValue (ConstantVariable (0.0)));
91.12 m_mobility.SetTypeId ("ns3::StaticMobilityModel");
91.13 }
91.14 MobilityHelper::~MobilityHelper ()
91.15 @@ -55,15 +56,15 @@
91.16 }
91.17 void
91.18 MobilityHelper::SetPositionAllocator (std::string type,
91.19 - std::string n1, Attribute v1,
91.20 - std::string n2, Attribute v2,
91.21 - std::string n3, Attribute v3,
91.22 - std::string n4, Attribute v4,
91.23 - std::string n5, Attribute v5,
91.24 - std::string n6, Attribute v6,
91.25 - std::string n7, Attribute v7,
91.26 - std::string n8, Attribute v8,
91.27 - std::string n9, Attribute v9)
91.28 + std::string n1, const AttributeValue &v1,
91.29 + std::string n2, const AttributeValue &v2,
91.30 + std::string n3, const AttributeValue &v3,
91.31 + std::string n4, const AttributeValue &v4,
91.32 + std::string n5, const AttributeValue &v5,
91.33 + std::string n6, const AttributeValue &v6,
91.34 + std::string n7, const AttributeValue &v7,
91.35 + std::string n8, const AttributeValue &v8,
91.36 + std::string n9, const AttributeValue &v9)
91.37 {
91.38 ObjectFactory pos;
91.39 pos.SetTypeId (type);
91.40 @@ -81,15 +82,15 @@
91.41
91.42 void
91.43 MobilityHelper::SetMobilityModel (std::string type,
91.44 - std::string n1, Attribute v1,
91.45 - std::string n2, Attribute v2,
91.46 - std::string n3, Attribute v3,
91.47 - std::string n4, Attribute v4,
91.48 - std::string n5, Attribute v5,
91.49 - std::string n6, Attribute v6,
91.50 - std::string n7, Attribute v7,
91.51 - std::string n8, Attribute v8,
91.52 - std::string n9, Attribute v9)
91.53 + std::string n1, const AttributeValue &v1,
91.54 + std::string n2, const AttributeValue &v2,
91.55 + std::string n3, const AttributeValue &v3,
91.56 + std::string n4, const AttributeValue &v4,
91.57 + std::string n5, const AttributeValue &v5,
91.58 + std::string n6, const AttributeValue &v6,
91.59 + std::string n7, const AttributeValue &v7,
91.60 + std::string n8, const AttributeValue &v8,
91.61 + std::string n9, const AttributeValue &v9)
91.62 {
91.63 m_mobility.SetTypeId (type);
91.64 m_mobility.Set (n1, v1);
91.65 @@ -147,8 +148,8 @@
91.66 // we need to setup a hierarchical mobility model
91.67 Ptr<MobilityModel> parent = m_mobilityStack.back ();
91.68 Ptr<MobilityModel> hierarchical =
91.69 - CreateObject<HierarchicalMobilityModel> ("Child", Pointer (model),
91.70 - "Parent", Pointer (parent));
91.71 + CreateObject<HierarchicalMobilityModel> ("Child", PointerValue (model),
91.72 + "Parent", PointerValue (parent));
91.73 object->AggregateObject (hierarchical);
91.74 NS_LOG_DEBUG ("node="<<object<<", mob="<<hierarchical);
91.75 }
92.1 --- a/src/helper/mobility-helper.h Mon Apr 14 16:19:17 2008 -0700
92.2 +++ b/src/helper/mobility-helper.h Thu Apr 17 13:42:25 2008 -0700
92.3 @@ -86,15 +86,15 @@
92.4 * \param v9 the value of the attribute to set in the mobility model.
92.5 */
92.6 void SetPositionAllocator (std::string type,
92.7 - std::string n1 = "", Attribute v1 = Attribute (),
92.8 - std::string n2 = "", Attribute v2 = Attribute (),
92.9 - std::string n3 = "", Attribute v3 = Attribute (),
92.10 - std::string n4 = "", Attribute v4 = Attribute (),
92.11 - std::string n5 = "", Attribute v5 = Attribute (),
92.12 - std::string n6 = "", Attribute v6 = Attribute (),
92.13 - std::string n7 = "", Attribute v7 = Attribute (),
92.14 - std::string n8 = "", Attribute v8 = Attribute (),
92.15 - std::string n9 = "", Attribute v9 = Attribute ());
92.16 + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
92.17 + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
92.18 + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
92.19 + std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
92.20 + std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
92.21 + std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
92.22 + std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue (),
92.23 + std::string n8 = "", const AttributeValue &v8 = EmptyAttributeValue (),
92.24 + std::string n9 = "", const AttributeValue &v9 = EmptyAttributeValue ());
92.25
92.26 /**
92.27 * \param type the type of mobility model to use.
92.28 @@ -121,15 +121,15 @@
92.29 * mobility model for each node.
92.30 */
92.31 void SetMobilityModel (std::string type,
92.32 - std::string n1 = "", Attribute v1 = Attribute (),
92.33 - std::string n2 = "", Attribute v2 = Attribute (),
92.34 - std::string n3 = "", Attribute v3 = Attribute (),
92.35 - std::string n4 = "", Attribute v4 = Attribute (),
92.36 - std::string n5 = "", Attribute v5 = Attribute (),
92.37 - std::string n6 = "", Attribute v6 = Attribute (),
92.38 - std::string n7 = "", Attribute v7 = Attribute (),
92.39 - std::string n8 = "", Attribute v8 = Attribute (),
92.40 - std::string n9 = "", Attribute v9 = Attribute ());
92.41 + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
92.42 + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
92.43 + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
92.44 + std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
92.45 + std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
92.46 + std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
92.47 + std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue (),
92.48 + std::string n8 = "", const AttributeValue &v8 = EmptyAttributeValue (),
92.49 + std::string n9 = "", const AttributeValue &v9 = EmptyAttributeValue ());
92.50
92.51 /**
92.52 * \param reference item to push.
93.1 --- a/src/helper/olsr-helper.cc Mon Apr 14 16:19:17 2008 -0700
93.2 +++ b/src/helper/olsr-helper.cc Thu Apr 17 13:42:25 2008 -0700
93.3 @@ -30,14 +30,14 @@
93.4
93.5 void
93.6 OlsrHelper::SetAgent (std::string tid,
93.7 - std::string n0, Attribute v0,
93.8 - std::string n1, Attribute v1,
93.9 - std::string n2, Attribute v2,
93.10 - std::string n3, Attribute v3,
93.11 - std::string n4, Attribute v4,
93.12 - std::string n5, Attribute v5,
93.13 - std::string n6, Attribute v6,
93.14 - std::string n7, Attribute v7)
93.15 + std::string n0, const AttributeValue &v0,
93.16 + std::string n1, const AttributeValue &v1,
93.17 + std::string n2, const AttributeValue &v2,
93.18 + std::string n3, const AttributeValue &v3,
93.19 + std::string n4, const AttributeValue &v4,
93.20 + std::string n5, const AttributeValue &v5,
93.21 + std::string n6, const AttributeValue &v6,
93.22 + std::string n7, const AttributeValue &v7)
93.23 {
93.24 m_agentFactory.SetTypeId (tid);
93.25 m_agentFactory.Set (n0, v0);
94.1 --- a/src/helper/olsr-helper.h Mon Apr 14 16:19:17 2008 -0700
94.2 +++ b/src/helper/olsr-helper.h Thu Apr 17 13:42:25 2008 -0700
94.3 @@ -32,14 +32,14 @@
94.4 OlsrHelper ();
94.5
94.6 void SetAgent (std::string tid,
94.7 - std::string n0 = "", Attribute v0 = Attribute (),
94.8 - std::string n1 = "", Attribute v2 = Attribute (),
94.9 - std::string n2 = "", Attribute v2 = Attribute (),
94.10 - std::string n3 = "", Attribute v3 = Attribute (),
94.11 - std::string n4 = "", Attribute v4 = Attribute (),
94.12 - std::string n5 = "", Attribute v5 = Attribute (),
94.13 - std::string n6 = "", Attribute v6 = Attribute (),
94.14 - std::string n7 = "", Attribute v7 = Attribute ());
94.15 + std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
94.16 + std::string n1 = "", const AttributeValue &v2 = EmptyAttributeValue (),
94.17 + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
94.18 + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
94.19 + std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
94.20 + std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
94.21 + std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
94.22 + std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
94.23
94.24 void Enable (NodeContainer container);
94.25 void Enable (Ptr<Node> node);
95.1 --- a/src/helper/on-off-helper.cc Mon Apr 14 16:19:17 2008 -0700
95.2 +++ b/src/helper/on-off-helper.cc Thu Apr 17 13:42:25 2008 -0700
95.3 @@ -27,12 +27,12 @@
95.4 OnOffHelper::OnOffHelper (std::string protocol, Address address)
95.5 {
95.6 m_factory.SetTypeId ("ns3::OnOffApplication");
95.7 - m_factory.Set ("Protocol", String(protocol));
95.8 - m_factory.Set ("Remote", address);
95.9 + m_factory.Set ("Protocol", StringValue (protocol));
95.10 + m_factory.Set ("Remote", AddressValue (address));
95.11 }
95.12
95.13 void
95.14 -OnOffHelper::SetAttribute (std::string name, Attribute value)
95.15 +OnOffHelper::SetAttribute (std::string name, const AttributeValue &value)
95.16 {
95.17 m_factory.Set (name, value);
95.18 }
96.1 --- a/src/helper/on-off-helper.h Mon Apr 14 16:19:17 2008 -0700
96.2 +++ b/src/helper/on-off-helper.h Thu Apr 17 13:42:25 2008 -0700
96.3 @@ -36,7 +36,7 @@
96.4 public:
96.5 OnOffHelper (std::string protocol, Address address);
96.6
96.7 - void SetAttribute (std::string name, Attribute value);
96.8 + void SetAttribute (std::string name, const AttributeValue &value);
96.9
96.10 ApplicationContainer Install (NodeContainer c);
96.11
97.1 --- a/src/helper/packet-sink-helper.cc Mon Apr 14 16:19:17 2008 -0700
97.2 +++ b/src/helper/packet-sink-helper.cc Thu Apr 17 13:42:25 2008 -0700
97.3 @@ -26,12 +26,12 @@
97.4 PacketSinkHelper::PacketSinkHelper (std::string protocol, Address address)
97.5 {
97.6 m_factory.SetTypeId ("ns3::PacketSink");
97.7 - m_factory.Set ("Protocol", String(protocol));
97.8 - m_factory.Set ("Local", address);
97.9 + m_factory.Set ("Protocol", StringValue (protocol));
97.10 + m_factory.Set ("Local", AddressValue (address));
97.11 }
97.12
97.13 void
97.14 -PacketSinkHelper::SetAttribute (std::string name, Attribute value)
97.15 +PacketSinkHelper::SetAttribute (std::string name, const AttributeValue &value)
97.16 {
97.17 m_factory.Set (name, value);
97.18 }
98.1 --- a/src/helper/packet-sink-helper.h Mon Apr 14 16:19:17 2008 -0700
98.2 +++ b/src/helper/packet-sink-helper.h Thu Apr 17 13:42:25 2008 -0700
98.3 @@ -32,7 +32,7 @@
98.4 public:
98.5 PacketSinkHelper (std::string protocol, Address address);
98.6
98.7 - void SetAttribute (std::string name, Attribute value);
98.8 + void SetAttribute (std::string name, const AttributeValue &value);
98.9
98.10 ApplicationContainer Install (NodeContainer c);
98.11 private:
99.1 --- a/src/helper/point-to-point-helper.cc Mon Apr 14 16:19:17 2008 -0700
99.2 +++ b/src/helper/point-to-point-helper.cc Thu Apr 17 13:42:25 2008 -0700
99.3 @@ -39,10 +39,10 @@
99.4
99.5 void
99.6 PointToPointHelper::SetQueue (std::string type,
99.7 - std::string n1, Attribute v1,
99.8 - std::string n2, Attribute v2,
99.9 - std::string n3, Attribute v3,
99.10 - std::string n4, Attribute v4)
99.11 + std::string n1, const AttributeValue &v1,
99.12 + std::string n2, const AttributeValue &v2,
99.13 + std::string n3, const AttributeValue &v3,
99.14 + std::string n4, const AttributeValue &v4)
99.15 {
99.16 m_queueFactory.SetTypeId (type);
99.17 m_queueFactory.Set (n1, v1);
99.18 @@ -52,13 +52,13 @@
99.19 }
99.20
99.21 void
99.22 -PointToPointHelper::SetDeviceParameter (std::string n1, Attribute v1)
99.23 +PointToPointHelper::SetDeviceParameter (std::string n1, const AttributeValue &v1)
99.24 {
99.25 m_deviceFactory.Set (n1, v1);
99.26 }
99.27
99.28 void
99.29 -PointToPointHelper::SetChannelParameter (std::string n1, Attribute v1)
99.30 +PointToPointHelper::SetChannelParameter (std::string n1, const AttributeValue &v1)
99.31 {
99.32 m_channelFactory.Set (n1, v1);
99.33 }
100.1 --- a/src/helper/point-to-point-helper.h Mon Apr 14 16:19:17 2008 -0700
100.2 +++ b/src/helper/point-to-point-helper.h Thu Apr 17 13:42:25 2008 -0700
100.3 @@ -56,10 +56,10 @@
100.4 * PointToPointNetDevice created through PointToPointHelper::Install.
100.5 */
100.6 void SetQueue (std::string type,
100.7 - std::string n1 = "", Attribute v1 = Attribute (),
100.8 - std::string n2 = "", Attribute v2 = Attribute (),
100.9 - std::string n3 = "", Attribute v3 = Attribute (),
100.10 - std::string n4 = "", Attribute v4 = Attribute ());
100.11 + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
100.12 + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
100.13 + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
100.14 + std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue ());
100.15
100.16 /**
100.17 * \param name the name of the attribute to set
100.18 @@ -68,7 +68,7 @@
100.19 * Set these parameters on each ns3::PointToPointNetDevice created
100.20 * by PointToPointHelper::Install
100.21 */
100.22 - void SetDeviceParameter (std::string name, Attribute value);
100.23 + void SetDeviceParameter (std::string name, const AttributeValue &value);
100.24 /**
100.25 * \param name the name of the attribute to set
100.26 * \param value the value of the attribute to set
100.27 @@ -76,7 +76,7 @@
100.28 * Set these parameters on each ns3::PointToPointChannel created
100.29 * by PointToPointHelper::Install
100.30 */
100.31 - void SetChannelParameter (std::string name, Attribute value);
100.32 + void SetChannelParameter (std::string name, const AttributeValue &value);
100.33
100.34 /**
100.35 * \param filename filename prefix to use for pcap files.
101.1 --- a/src/helper/udp-echo-helper.cc Mon Apr 14 16:19:17 2008 -0700
101.2 +++ b/src/helper/udp-echo-helper.cc Thu Apr 17 13:42:25 2008 -0700
101.3 @@ -40,7 +40,7 @@
101.4 for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
101.5 {
101.6 Ptr<Node> node = *i;
101.7 - Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> ("Port", Uinteger (m_port));
101.8 + Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> ("Port", UintegerValue (m_port));
101.9 node->AddApplication (server);
101.10 apps.Add (server);
101.11 }
101.12 @@ -58,7 +58,7 @@
101.13 m_remotePort = port;
101.14 }
101.15 void
101.16 -UdpEchoClientHelper::SetAppAttribute (std::string name, Attribute value)
101.17 +UdpEchoClientHelper::SetAppAttribute (std::string name, const AttributeValue &value)
101.18 {
101.19 m_factory.Set (name, value);
101.20 }
102.1 --- a/src/helper/udp-echo-helper.h Mon Apr 14 16:19:17 2008 -0700
102.2 +++ b/src/helper/udp-echo-helper.h Thu Apr 17 13:42:25 2008 -0700
102.3 @@ -44,7 +44,7 @@
102.4 UdpEchoClientHelper ();
102.5
102.6 void SetRemote (Ipv4Address ip, uint16_t port);
102.7 - void SetAppAttribute (std::string name, Attribute value);
102.8 + void SetAppAttribute (std::string name, const AttributeValue &value);
102.9 ApplicationContainer Install (NodeContainer c);
102.10 private:
102.11 ObjectFactory m_factory;
103.1 --- a/src/helper/wifi-helper.cc Mon Apr 14 16:19:17 2008 -0700
103.2 +++ b/src/helper/wifi-helper.cc Thu Apr 17 13:42:25 2008 -0700
103.3 @@ -78,14 +78,14 @@
103.4
103.5 void
103.6 WifiHelper::SetRemoteStationManager (std::string type,
103.7 - std::string n0, Attribute v0,
103.8 - std::string n1, Attribute v1,
103.9 - std::string n2, Attribute v2,
103.10 - std::string n3, Attribute v3,
103.11 - std::string n4, Attribute v4,
103.12 - std::string n5, Attribute v5,
103.13 - std::string n6, Attribute v6,
103.14 - std::string n7, Attribute v7)
103.15 + std::string n0, const AttributeValue &v0,
103.16 + std::string n1, const AttributeValue &v1,
103.17 + std::string n2, const AttributeValue &v2,
103.18 + std::string n3, const AttributeValue &v3,
103.19 + std::string n4, const AttributeValue &v4,
103.20 + std::string n5, const AttributeValue &v5,
103.21 + std::string n6, const AttributeValue &v6,
103.22 + std::string n7, const AttributeValue &v7)
103.23 {
103.24 m_stationManager = ObjectFactory ();
103.25 m_stationManager.SetTypeId (type);
103.26 @@ -101,14 +101,14 @@
103.27
103.28 void
103.29 WifiHelper::SetMac (std::string type,
103.30 - std::string n0, Attribute v0,
103.31 - std::string n1, Attribute v1,
103.32 - std::string n2, Attribute v2,
103.33 - std::string n3, Attribute v3,
103.34 - std::string n4, Attribute v4,
103.35 - std::string n5, Attribute v5,
103.36 - std::string n6, Attribute v6,
103.37 - std::string n7, Attribute v7)
103.38 + std::string n0, const AttributeValue &v0,
103.39 + std::string n1, const AttributeValue &v1,
103.40 + std::string n2, const AttributeValue &v2,
103.41 + std::string n3, const AttributeValue &v3,
103.42 + std::string n4, const AttributeValue &v4,
103.43 + std::string n5, const AttributeValue &v5,
103.44 + std::string n6, const AttributeValue &v6,
103.45 + std::string n7, const AttributeValue &v7)
103.46 {
103.47 m_mac = ObjectFactory ();
103.48 m_mac.SetTypeId (type);
103.49 @@ -124,14 +124,14 @@
103.50
103.51 void
103.52 WifiHelper::SetPhy (std::string type,
103.53 - std::string n0, Attribute v0,
103.54 - std::string n1, Attribute v1,
103.55 - std::string n2, Attribute v2,
103.56 - std::string n3, Attribute v3,
103.57 - std::string n4, Attribute v4,
103.58 - std::string n5, Attribute v5,
103.59 - std::string n6, Attribute v6,
103.60 - std::string n7, Attribute v7)
103.61 + std::string n0, const AttributeValue &v0,
103.62 + std::string n1, const AttributeValue &v1,
103.63 + std::string n2, const AttributeValue &v2,
103.64 + std::string n3, const AttributeValue &v3,
103.65 + std::string n4, const AttributeValue &v4,
103.66 + std::string n5, const AttributeValue &v5,
103.67 + std::string n6, const AttributeValue &v6,
103.68 + std::string n7, const AttributeValue &v7)
103.69 {
103.70 m_phy = ObjectFactory ();
103.71 m_phy.SetTypeId (type);
104.1 --- a/src/helper/wifi-helper.h Mon Apr 14 16:19:17 2008 -0700
104.2 +++ b/src/helper/wifi-helper.h Thu Apr 17 13:42:25 2008 -0700
104.3 @@ -65,14 +65,14 @@
104.4 * in the requested station manager.
104.5 */
104.6 void SetRemoteStationManager (std::string type,
104.7 - std::string n0 = "", Attribute v0 = Attribute (),
104.8 - std::string n1 = "", Attribute v1 = Attribute (),
104.9 - std::string n2 = "", Attribute v2 = Attribute (),
104.10 - std::string n3 = "", Attribute v3 = Attribute (),
104.11 - std::string n4 = "", Attribute v4 = Attribute (),
104.12 - std::string n5 = "", Attribute v5 = Attribute (),
104.13 - std::string n6 = "", Attribute v6 = Attribute (),
104.14 - std::string n7 = "", Attribute v7 = Attribute ());
104.15 + std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
104.16 + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
104.17 + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
104.18 + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
104.19 + std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
104.20 + std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
104.21 + std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
104.22 + std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
104.23
104.24 /**
104.25 * \param type the type of ns3::WifiMac to create.
104.26 @@ -97,14 +97,14 @@
104.27 * in the requested mac.
104.28 */
104.29 void SetMac (std::string type,
104.30 - std::string n0 = "", Attribute v0 = Attribute (),
104.31 - std::string n1 = "", Attribute v1 = Attribute (),
104.32 - std::string n2 = "", Attribute v2 = Attribute (),
104.33 - std::string n3 = "", Attribute v3 = Attribute (),
104.34 - std::string n4 = "", Attribute v4 = Attribute (),
104.35 - std::string n5 = "", Attribute v5 = Attribute (),
104.36 - std::string n6 = "", Attribute v6 = Attribute (),
104.37 - std::string n7 = "", Attribute v7 = Attribute ());
104.38 + std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
104.39 + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
104.40 + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
104.41 + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
104.42 + std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
104.43 + std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
104.44 + std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
104.45 + std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
104.46
104.47 /**
104.48 * \param phyType the type of ns3::WifiPhy to create.
104.49 @@ -129,14 +129,14 @@
104.50 * in the requested phy.
104.51 */
104.52 void SetPhy (std::string phyType,
104.53 - std::string n0 = "", Attribute v0 = Attribute (),
104.54 - std::string n1 = "", Attribute v1 = Attribute (),
104.55 - std::string n2 = "", Attribute v2 = Attribute (),
104.56 - std::string n3 = "", Attribute v3 = Attribute (),
104.57 - std::string n4 = "", Attribute v4 = Attribute (),
104.58 - std::string n5 = "", Attribute v5 = Attribute (),
104.59 - std::string n6 = "", Attribute v6 = Attribute (),
104.60 - std::string n7 = "", Attribute v7 = Attribute ());
104.61 + std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
104.62 + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
104.63 + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
104.64 + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
104.65 + std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
104.66 + std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
104.67 + std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
104.68 + std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
104.69
104.70
104.71
105.1 --- a/src/internet-node/ipv4-l3-protocol.cc Mon Apr 14 16:19:17 2008 -0700
105.2 +++ b/src/internet-node/ipv4-l3-protocol.cc Thu Apr 17 13:42:25 2008 -0700
105.3 @@ -52,7 +52,7 @@
105.4 .SetParent<Object> ()
105.5 .AddConstructor<Ipv4L3Protocol> ()
105.6 .AddAttribute ("DefaultTtl", "The TTL value set by default on all outgoing packets generated on this node.",
105.7 - Uinteger (64),
105.8 + UintegerValue (64),
105.9 MakeUintegerAccessor (&Ipv4L3Protocol::m_defaultTtl),
105.10 MakeUintegerChecker<uint8_t> ())
105.11 .AddTraceSource ("Tx", "Send ipv4 packet to outgoing interface.",
105.12 @@ -62,7 +62,7 @@
105.13 .AddTraceSource ("Drop", "Drop ipv4 packet",
105.14 MakeTraceSourceAccessor (&Ipv4L3Protocol::m_dropTrace))
105.15 .AddAttribute ("InterfaceList", "The set of Ipv4 interfaces associated to this Ipv4 stack.",
105.16 - ObjectVector (),
105.17 + ObjectVectorValue (),
105.18 MakeObjectVectorAccessor (&Ipv4L3Protocol::m_interfaces),
105.19 MakeObjectVectorChecker<Ipv4Interface> ())
105.20 ;
106.1 --- a/src/internet-node/ipv4-l4-demux.cc Mon Apr 14 16:19:17 2008 -0700
106.2 +++ b/src/internet-node/ipv4-l4-demux.cc Thu Apr 17 13:42:25 2008 -0700
106.3 @@ -37,7 +37,7 @@
106.4 static TypeId tid = TypeId ("ns3::Ipv4L4Demux")
106.5 .SetParent<Object> ()
106.6 .AddAttribute ("Protocols", "The set of protocols registered with this demux.",
106.7 - ObjectVector (),
106.8 + ObjectVectorValue (),
106.9 MakeObjectVectorAccessor (&Ipv4L4Demux::m_protocols),
106.10 MakeObjectVectorChecker<Ipv4L4Protocol> ())
106.11 ;
107.1 --- a/src/internet-node/ipv4-l4-protocol.cc Mon Apr 14 16:19:17 2008 -0700
107.2 +++ b/src/internet-node/ipv4-l4-protocol.cc Thu Apr 17 13:42:25 2008 -0700
107.3 @@ -34,11 +34,11 @@
107.4 static TypeId tid = TypeId ("ns3::Ipv4L4Protocol")
107.5 .SetParent<Object> ()
107.6 .AddAttribute ("ProtocolNumber", "The Ipv4 protocol number.",
107.7 - Uinteger (0),
107.8 + UintegerValue (0),
107.9 MakeUintegerAccessor (&Ipv4L4Protocol::GetProtocolNumber),
107.10 MakeUintegerChecker<int> ())
107.11 .AddAttribute ("Version", "The version of the protocol.",
107.12 - Uinteger (0),
107.13 + UintegerValue (0),
107.14 MakeUintegerAccessor (&Ipv4L4Protocol::GetVersion),
107.15 MakeUintegerChecker<int> ())
107.16 ;
108.1 --- a/src/internet-node/rtt-estimator.cc Mon Apr 14 16:19:17 2008 -0700
108.2 +++ b/src/internet-node/rtt-estimator.cc Thu Apr 17 13:42:25 2008 -0700
108.3 @@ -43,12 +43,12 @@
108.4 .SetParent<Object> ()
108.5 .AddAttribute ("MaxMultiplier",
108.6 "XXX",
108.7 - Double (64.0),
108.8 + DoubleValue (64.0),
108.9 MakeDoubleAccessor (&RttEstimator::m_maxMultiplier),
108.10 MakeDoubleChecker<double> ())
108.11 .AddAttribute ("InitialEstimation",
108.12 "XXX",
108.13 - Seconds (1.0),
108.14 + TimeValue (Seconds (1.0)),
108.15 MakeTimeAccessor (&RttEstimator::est),
108.16 MakeTimeChecker ())
108.17 ;
108.18 @@ -177,7 +177,7 @@
108.19 .AddConstructor<RttMeanDeviation> ()
108.20 .AddAttribute ("Gain",
108.21 "XXX",
108.22 - Double (0.1),
108.23 + DoubleValue (0.1),
108.24 MakeDoubleAccessor (&RttMeanDeviation::gain),
108.25 MakeDoubleChecker<double> ())
108.26 ;
109.1 --- a/src/internet-node/tcp-l4-protocol.cc Mon Apr 14 16:19:17 2008 -0700
109.2 +++ b/src/internet-node/tcp-l4-protocol.cc Thu Apr 17 13:42:25 2008 -0700
109.3 @@ -327,7 +327,7 @@
109.4 .SetParent<Ipv4L4Protocol> ()
109.5 .AddAttribute ("RttEstimatorFactory",
109.6 "How RttEstimator objects are created.",
109.7 - GetDefaultRttEstimatorFactory (),
109.8 + ObjectFactoryValue (GetDefaultRttEstimatorFactory ()),
109.9 MakeObjectFactoryAccessor (&TcpL4Protocol::m_rttFactory),
109.10 MakeObjectFactoryChecker ())
109.11 ;
110.1 --- a/src/internet-node/tcp-socket.cc Mon Apr 14 16:19:17 2008 -0700
110.2 +++ b/src/internet-node/tcp-socket.cc Thu Apr 17 13:42:25 2008 -0700
110.3 @@ -1165,7 +1165,7 @@
110.4 // Collapse congestion window (re-enter slowstart)
110.5 m_cWnd = m_segmentSize;
110.6 m_nextTxSequence = m_highestRxAck; // Start from highest Ack
110.7 - m_rtt->IncreaseMultiplier (); // Double timeout value for next retx timer
110.8 + m_rtt->IncreaseMultiplier (); // DoubleValue timeout value for next retx timer
110.9 Retransmit (); // Retransmit the packet
110.10 }
110.11
111.1 --- a/src/mobility/hierarchical-mobility-model.cc Mon Apr 14 16:19:17 2008 -0700
111.2 +++ b/src/mobility/hierarchical-mobility-model.cc Thu Apr 17 13:42:25 2008 -0700
111.3 @@ -32,11 +32,11 @@
111.4 .SetParent<MobilityModel> ()
111.5 .AddConstructor<HierarchicalMobilityModel> ()
111.6 .AddAttribute ("Child", "The child mobility model.",
111.7 - Pointer (),
111.8 + PointerValue (),
111.9 MakePointerAccessor (&HierarchicalMobilityModel::SetChild),
111.10 MakePointerChecker<MobilityModel> ())
111.11 .AddAttribute ("Parent", "The parent mobility model.",
111.12 - Pointer (),
111.13 + PointerValue (),
111.14 MakePointerAccessor (&HierarchicalMobilityModel::SetParent),
111.15 MakePointerChecker<MobilityModel> ())
111.16 ;
112.1 --- a/src/mobility/mobility-model.cc Mon Apr 14 16:19:17 2008 -0700
112.2 +++ b/src/mobility/mobility-model.cc Thu Apr 17 13:42:25 2008 -0700
112.3 @@ -30,13 +30,13 @@
112.4 .SetParent<Object> ()
112.5 .AddAttribute ("Position", "The current position of the mobility model.",
112.6 TypeId::ATTR_SGC,
112.7 - Vector (0.0, 0.0, 0.0),
112.8 + VectorValue (Vector (0.0, 0.0, 0.0)),
112.9 MakeVectorAccessor (&MobilityModel::SetPosition,
112.10 &MobilityModel::GetPosition),
112.11 MakeVectorChecker ())
112.12 .AddAttribute ("Velocity", "The current velocity of the mobility model.",
112.13 TypeId::ATTR_GET,
112.14 - Vector (0.0, 0.0, 0.0), // ignored initial value.
112.15 + VectorValue (Vector (0.0, 0.0, 0.0)), // ignored initial value.
112.16 MakeVectorAccessor (&MobilityModel::GetVelocity),
112.17 MakeVectorChecker ())
112.18 ;
113.1 --- a/src/mobility/position-allocator.cc Mon Apr 14 16:19:17 2008 -0700
113.2 +++ b/src/mobility/position-allocator.cc Thu Apr 17 13:42:25 2008 -0700
113.3 @@ -83,27 +83,27 @@
113.4 .SetGroupName ("Mobility")
113.5 .AddConstructor<GridPositionAllocator> ()
113.6 .AddAttribute ("GridWidth", "The number of objects layed out on a line.",
113.7 - Uinteger (10),
113.8 + UintegerValue (10),
113.9 MakeUintegerAccessor (&GridPositionAllocator::m_n),
113.10 MakeUintegerChecker<uint32_t> ())
113.11 .AddAttribute ("MinX", "The x coordinate where the grid starts.",
113.12 - Double (1.0),
113.13 + DoubleValue (1.0),
113.14 MakeDoubleAccessor (&GridPositionAllocator::m_xMin),
113.15 MakeDoubleChecker<double> ())
113.16 .AddAttribute ("MinY", "The y coordinate where the grid starts.",
113.17 - Double (0.0),
113.18 + DoubleValue (0.0),
113.19 MakeDoubleAccessor (&GridPositionAllocator::m_yMin),
113.20 MakeDoubleChecker<double> ())
113.21 .AddAttribute ("DeltaX", "The x space between objects.",
113.22 - Double (1.0),
113.23 + DoubleValue (1.0),
113.24 MakeDoubleAccessor (&GridPositionAllocator::m_deltaX),
113.25 MakeDoubleChecker<double> ())
113.26 .AddAttribute ("DeltaY", "The y space between objects.",
113.27 - Double (1.0),
113.28 + DoubleValue (1.0),
113.29 MakeDoubleAccessor (&GridPositionAllocator::m_deltaY),
113.30 MakeDoubleChecker<double> ())
113.31 .AddAttribute ("LayoutType", "The type of layout.",
113.32 - Enum (ROW_FIRST),
113.33 + EnumValue (ROW_FIRST),
113.34 MakeEnumAccessor (&GridPositionAllocator::m_layoutType),
113.35 MakeEnumChecker (ROW_FIRST, "RowFirst",
113.36 COLUMN_FIRST, "ColumnFirst"))
113.37 @@ -206,12 +206,12 @@
113.38 .AddConstructor<RandomRectanglePositionAllocator> ()
113.39 .AddAttribute ("X",
113.40 "A random variable which represents the x coordinate of a position in a random rectangle.",
113.41 - UniformVariable (0.0, 1.0),
113.42 + RandomVariableValue (UniformVariable (0.0, 1.0)),
113.43 MakeRandomVariableAccessor (&RandomRectanglePositionAllocator::m_x),
113.44 MakeRandomVariableChecker ())
113.45 .AddAttribute ("Y",
113.46 "A random variable which represents the y coordinate of a position in a random rectangle.",
113.47 - UniformVariable (0.0, 1.0),
113.48 + RandomVariableValue (UniformVariable (0.0, 1.0)),
113.49 MakeRandomVariableAccessor (&RandomRectanglePositionAllocator::m_y),
113.50 MakeRandomVariableChecker ());
113.51 return tid;
113.52 @@ -252,22 +252,22 @@
113.53 .AddConstructor<RandomDiscPositionAllocator> ()
113.54 .AddAttribute ("Theta",
113.55 "A random variable which represents the angle (gradients) of a position in a random disc.",
113.56 - UniformVariable (0.0, 6.2830),
113.57 + RandomVariableValue (UniformVariable (0.0, 6.2830)),
113.58 MakeRandomVariableAccessor (&RandomDiscPositionAllocator::m_theta),
113.59 MakeRandomVariableChecker ())
113.60 .AddAttribute ("Rho",
113.61 "A random variable which represents the radius of a position in a random disc.",
113.62 - UniformVariable (0.0, 200.0),
113.63 + RandomVariableValue (UniformVariable (0.0, 200.0)),
113.64 MakeRandomVariableAccessor (&RandomDiscPositionAllocator::m_rho),
113.65 MakeRandomVariableChecker ())
113.66 .AddAttribute ("X",
113.67 "The x coordinate of the center of the random position disc.",
113.68 - Double (0.0),
113.69 + DoubleValue (0.0),
113.70 MakeDoubleAccessor (&RandomDiscPositionAllocator::m_x),
113.71 MakeDoubleChecker<double> ())
113.72 .AddAttribute ("Y",
113.73 "The y coordinate of the center of the random position disc.",
113.74 - Double (0.0),
113.75 + DoubleValue (0.0),
113.76 MakeDoubleAccessor (&RandomDiscPositionAllocator::m_y),
113.77 MakeDoubleChecker<double> ())
113.78 ;
114.1 --- a/src/mobility/random-direction-2d-mobility-model.cc Mon Apr 14 16:19:17 2008 -0700
114.2 +++ b/src/mobility/random-direction-2d-mobility-model.cc Thu Apr 17 13:42:25 2008 -0700
114.3 @@ -40,15 +40,15 @@
114.4 .SetGroupName ("Mobility")
114.5 .AddConstructor<RandomDirection2dMobilityModel> ()
114.6 .AddAttribute ("Bounds", "The 2d bounding area",
114.7 - Rectangle (-100, 100, -100, 100),
114.8 + RectangleValue (Rectangle (-100, 100, -100, 100)),
114.9 MakeRectangleAccessor (&RandomDirection2dMobilityModel::m_bounds),
114.10 MakeRectangleChecker ())
114.11 .AddAttribute ("Speed", "A random variable to control the speed (m/s).",
114.12 - UniformVariable (1.0, 2.0),
114.13 + RandomVariableValue (UniformVariable (1.0, 2.0)),
114.14 MakeRandomVariableAccessor (&RandomDirection2dMobilityModel::m_speed),
114.15 MakeRandomVariableChecker ())
114.16 .AddAttribute ("Pause", "A random variable to control the pause (s).",
114.17 - ConstantVariable (2.0),
114.18 + RandomVariableValue (ConstantVariable (2.0)),
114.19 MakeRandomVariableAccessor (&RandomDirection2dMobilityModel::m_pause),
114.20 MakeRandomVariableChecker ())
114.21 ;
115.1 --- a/src/mobility/random-walk-2d-mobility-model.cc Mon Apr 14 16:19:17 2008 -0700
115.2 +++ b/src/mobility/random-walk-2d-mobility-model.cc Thu Apr 17 13:42:25 2008 -0700
115.3 @@ -19,6 +19,7 @@
115.4 */
115.5 #include "random-walk-2d-mobility-model.h"
115.6 #include "ns3/enum.h"
115.7 +#include "ns3/double.h"
115.8 #include "ns3/simulator.h"
115.9 #include "ns3/log.h"
115.10 #include <cmath>
115.11 @@ -38,34 +39,34 @@
115.12 .AddConstructor<RandomWalk2dMobilityModel> ()
115.13 .AddAttribute ("Bounds",
115.14 "Bounds of the area to cruise.",
115.15 - Rectangle (0.0, 0.0, 100.0, 100.0),
115.16 + RectangleValue (Rectangle (0.0, 0.0, 100.0, 100.0)),
115.17 MakeRectangleAccessor (&RandomWalk2dMobilityModel::m_bounds),
115.18 MakeRectangleChecker ())
115.19 .AddAttribute ("Time",
115.20 "Change current direction and speed after moving for this delay.",
115.21 - Seconds (1.0),
115.22 + TimeValue (Seconds (1.0)),
115.23 MakeTimeAccessor (&RandomWalk2dMobilityModel::m_modeTime),
115.24 MakeTimeChecker ())
115.25 .AddAttribute ("Distance",
115.26 "Change current direction and speed after moving for this distance.",
115.27 - Seconds (1.0),
115.28 - MakeTimeAccessor (&RandomWalk2dMobilityModel::m_modeTime),
115.29 - MakeTimeChecker ())
115.30 + DoubleValue (1.0),
115.31 + MakeDoubleAccessor (&RandomWalk2dMobilityModel::m_modeDistance),
115.32 + MakeDoubleChecker<double> ())
115.33 .AddAttribute ("Mode",
115.34 "The mode indicates the condition used to "
115.35 "change the current speed and direction",
115.36 - Enum (RandomWalk2dMobilityModel::MODE_DISTANCE),
115.37 + EnumValue (RandomWalk2dMobilityModel::MODE_DISTANCE),
115.38 MakeEnumAccessor (&RandomWalk2dMobilityModel::m_mode),
115.39 MakeEnumChecker (RandomWalk2dMobilityModel::MODE_DISTANCE, "Distance",
115.40 RandomWalk2dMobilityModel::MODE_TIME, "Time"))
115.41 .AddAttribute ("Direction",
115.42 "A random variable used to pick the direction (gradients).",
115.43 - UniformVariable (0.0, 6.283184),
115.44 + RandomVariableValue (UniformVariable (0.0, 6.283184)),
115.45 MakeRandomVariableAccessor (&RandomWalk2dMobilityModel::m_direction),
115.46 MakeRandomVariableChecker ())
115.47 .AddAttribute ("Speed",
115.48 "A random variable used to pick the speed (m/s).",
115.49 - UniformVariable (2.0, 4.0),
115.50 + RandomVariableValue (UniformVariable (2.0, 4.0)),
115.51 MakeRandomVariableAccessor (&RandomWalk2dMobilityModel::m_speed),
115.52 MakeRandomVariableChecker ());
115.53 return tid;
116.1 --- a/src/mobility/random-waypoint-mobility-model.cc Mon Apr 14 16:19:17 2008 -0700
116.2 +++ b/src/mobility/random-waypoint-mobility-model.cc Thu Apr 17 13:42:25 2008 -0700
116.3 @@ -37,17 +37,17 @@
116.4 .AddConstructor<RandomWaypointMobilityModel> ()
116.5 .AddAttribute ("Speed",
116.6 "A random variable used to pick the speed of a random waypoint model.",
116.7 - UniformVariable (0.3, 0.7),
116.8 + RandomVariableValue (UniformVariable (0.3, 0.7)),
116.9 MakeRandomVariableAccessor (&RandomWaypointMobilityModel::m_speed),
116.10 MakeRandomVariableChecker ())
116.11 .AddAttribute ("Pause",
116.12 "A random variable used to pick the pause of a random waypoint model.",
116.13 - ConstantVariable (2.0),
116.14 + RandomVariableValue (ConstantVariable (2.0)),
116.15 MakeRandomVariableAccessor (&RandomWaypointMobilityModel::m_pause),
116.16 MakeRandomVariableChecker ())
116.17 .AddAttribute ("Position",
116.18 "The position model used to pick a destination point.",
116.19 - Pointer (),
116.20 + PointerValue (),
116.21 MakePointerAccessor (&RandomWaypointMobilityModel::m_position),
116.22 MakePointerChecker<PositionAllocator> ());
116.23
117.1 --- a/src/node/drop-tail-queue.cc Mon Apr 14 16:19:17 2008 -0700
117.2 +++ b/src/node/drop-tail-queue.cc Thu Apr 17 13:42:25 2008 -0700
117.3 @@ -32,7 +32,7 @@
117.4 .SetParent<Queue> ()
117.5 .AddConstructor<DropTailQueue> ()
117.6 .AddAttribute ("MaxPackets", "The maximum number of packets accepted by this DropTailQueue.",
117.7 - Uinteger (100),
117.8 + UintegerValue (100),
117.9 MakeUintegerAccessor (&DropTailQueue::m_maxPackets),
117.10 MakeUintegerChecker<uint32_t> ())
117.11 ;
117.12 @@ -132,7 +132,7 @@
117.13 bool result = true;
117.14
117.15 Ptr<DropTailQueue> queue = CreateObject<DropTailQueue> ();
117.16 - NS_TEST_ASSERT (queue->SetAttributeFailSafe ("MaxPackets", Uinteger (3)));
117.17 + NS_TEST_ASSERT (queue->SetAttributeFailSafe ("MaxPackets", UintegerValue (3)));
117.18
117.19 Ptr<Packet> p1, p2, p3, p4;
117.20 p1 = Create<Packet> ();
118.1 --- a/src/node/node-list.cc Mon Apr 14 16:19:17 2008 -0700
118.2 +++ b/src/node/node-list.cc Thu Apr 17 13:42:25 2008 -0700
118.3 @@ -62,7 +62,7 @@
118.4 static TypeId tid = TypeId ("ns3::NodeListPriv")
118.5 .SetParent<Object> ()
118.6 .AddAttribute ("NodeList", "The list of all nodes created during the simulation.",
118.7 - ObjectVector (),
118.8 + ObjectVectorValue (),
118.9 MakeObjectVectorAccessor (&NodeListPriv::m_nodes),
118.10 MakeObjectVectorChecker<Node> ())
118.11 ;
119.1 --- a/src/node/node.cc Mon Apr 14 16:19:17 2008 -0700
119.2 +++ b/src/node/node.cc Thu Apr 17 13:42:25 2008 -0700
119.3 @@ -37,16 +37,16 @@
119.4 static TypeId tid = TypeId ("ns3::Node")
119.5 .SetParent<Object> ()
119.6 .AddAttribute ("DeviceList", "The list of devices associated to this Node.",
119.7 - ObjectVector (),
119.8 + ObjectVectorValue (),
119.9 MakeObjectVectorAccessor (&Node::m_devices),
119.10 MakeObjectVectorChecker<NetDevice> ())
119.11 .AddAttribute ("ApplicationList", "The list of applications associated to this Node.",
119.12 - ObjectVector (),
119.13 + ObjectVectorValue (),
119.14 MakeObjectVectorAccessor (&Node::m_applications),
119.15 MakeObjectVectorChecker<Application> ())
119.16 .AddAttribute ("Id", "The id (unique integer) of this Node.",
119.17 TypeId::ATTR_GET, // allow only getting it.
119.18 - Uinteger (0),
119.19 + UintegerValue (0),
119.20 MakeUintegerAccessor (&Node::m_id),
119.21 MakeUintegerChecker<uint32_t> ())
119.22 ;
120.1 --- a/src/node/tcp.cc Mon Apr 14 16:19:17 2008 -0700
120.2 +++ b/src/node/tcp.cc Thu Apr 17 13:42:25 2008 -0700
120.3 @@ -32,52 +32,52 @@
120.4 .SetParent<SocketFactory> ()
120.5 .AddAttribute ("TcpDefaultSegmentSize",
120.6 "Default TCP maximum segment size in bytes (may be adjusted based on MTU discovery)",
120.7 - Uinteger (536),
120.8 + UintegerValue (536),
120.9 MakeUintegerAccessor (&Tcp::m_defaultSegSize),
120.10 MakeUintegerChecker<uint32_t> ())
120.11 .AddAttribute ("TcpDefaultAdvertisedWindowSize",
120.12 "Default TCP advertised window size (bytes)",
120.13 - Uinteger (0xffff),
120.14 + UintegerValue (0xffff),
120.15 MakeUintegerAccessor (&Tcp::m_defaultAdvWin),
120.16 MakeUintegerChecker<uint32_t> ())
120.17 .AddAttribute ("TcpDefaultSlowStartThreshold",
120.18 "Default TCP slow start threshold (bytes)",
120.19 - Uinteger (0xffff),
120.20 + UintegerValue (0xffff),
120.21 MakeUintegerAccessor (&Tcp::m_defaultSsThresh),
120.22 MakeUintegerChecker<uint32_t> ())
120.23 .AddAttribute ("TcpDefaultTxBufferSize",
120.24 "Default TCP maximum transmit buffer size (bytes)",
120.25 - Uinteger (0xffffffffl),
120.26 + UintegerValue (0xffffffffl),
120.27 MakeUintegerAccessor (&Tcp::m_defaultTxBuffer),
120.28 MakeUintegerChecker<uint32_t> ())
120.29 .AddAttribute ("TcpDefaultRxBufferSize",
120.30 "Default TCP maximum receive buffer size (bytes)",
120.31 - Uinteger (0xffffffffl),
120.32 + UintegerValue (0xffffffffl),
120.33 MakeUintegerAccessor (&Tcp::m_defaultRxBuffer),
120.34 MakeUintegerChecker<uint32_t> ())
120.35 .AddAttribute ("TcpDefaultInitialCongestionWindowSize",
120.36 "Default TCP initial congestion window size (segments)",
120.37 - Uinteger (1),
120.38 + UintegerValue (1),
120.39 MakeUintegerAccessor (&Tcp::m_defaultInitialCwnd),
120.40 MakeUintegerChecker<uint32_t> ())
120.41 .AddAttribute ("TcpDefaultConnTimeout",
120.42 "Default TCP retransmission timeout when opening connection (seconds)",
120.43 - Uinteger (3),
120.44 + UintegerValue (3),
120.45 MakeUintegerAccessor (&Tcp::m_defaultConnTimeout),
120.46 MakeUintegerChecker<uint32_t> ())
120.47 .AddAttribute ("TcpDefaultConnCount",
120.48 "Default number of connection attempts (SYN retransmissions) before returning failure",
120.49 - Uinteger (6),
120.50 + UintegerValue (6),
120.51 MakeUintegerAccessor (&Tcp::m_defaultConnCount),
120.52 MakeUintegerChecker<uint32_t> ())
120.53 .AddAttribute ("TcpDefaultDelAckTimeout",
120.54 "Default timeout value for TCP delayed acks, in seconds",
120.55 - Double (0.2),
120.56 + DoubleValue (0.2),
120.57 MakeDoubleAccessor (&Tcp::m_defaultDelAckTimeout),
120.58 MakeDoubleChecker<double> ())
120.59 .AddAttribute ("TcpDefaultDelAckCount",
120.60 "Default number of packets to wait before sending a TCP ack",
120.61 - Uinteger (2),
120.62 + UintegerValue (2),
120.63 MakeUintegerAccessor (&Tcp::m_defaultDelAckCount),
120.64 MakeUintegerChecker<uint32_t> ())
120.65 ;
121.1 --- a/src/routing/olsr/olsr-agent-impl.cc Mon Apr 14 16:19:17 2008 -0700
121.2 +++ b/src/routing/olsr/olsr-agent-impl.cc Thu Apr 17 13:42:25 2008 -0700
121.3 @@ -157,19 +157,19 @@
121.4 .SetParent<Agent> ()
121.5 .AddConstructor<AgentImpl> ()
121.6 .AddAttribute ("HelloInterval", "XXX",
121.7 - OLSR_HELLO_INTERVAL,
121.8 + TimeValue (OLSR_HELLO_INTERVAL),
121.9 MakeTimeAccessor (&AgentImpl::m_helloInterval),
121.10 MakeTimeChecker ())
121.11 .AddAttribute ("TcInterval", "XXX",
121.12 - OLSR_TC_INTERVAL,
121.13 + TimeValue (OLSR_TC_INTERVAL),
121.14 MakeTimeAccessor (&AgentImpl::m_tcInterval),
121.15 MakeTimeChecker ())
121.16 .AddAttribute ("MidInterval", "XXX",
121.17 - OLSR_MID_INTERVAL,
121.18 + TimeValue (OLSR_MID_INTERVAL),
121.19 MakeTimeAccessor (&AgentImpl::m_midInterval),
121.20 MakeTimeChecker ())
121.21 .AddAttribute ("Willingness", "XXX",
121.22 - Uinteger (OLSR_WILL_DEFAULT),
121.23 + UintegerValue (OLSR_WILL_DEFAULT),
121.24 MakeUintegerAccessor (&AgentImpl::m_willingness),
121.25 MakeUintegerChecker<uint8_t> ())
121.26 .AddTraceSource ("Rx", "Receive OLSR packet.",
122.1 --- a/src/simulator/nstime.h Mon Apr 14 16:19:17 2008 -0700
122.2 +++ b/src/simulator/nstime.h Thu Apr 17 13:42:25 2008 -0700
122.3 @@ -436,8 +436,6 @@
122.4 static uint64_t UnitsToTimestep (uint64_t unitValue,
122.5 uint64_t unitFactor);
122.6
122.7 - TimeUnit (Attribute value);
122.8 - operator Attribute () const;
122.9 private:
122.10 HighPrecision m_data;
122.11
123.1 --- a/src/simulator/simulator.cc Mon Apr 14 16:19:17 2008 -0700
123.2 +++ b/src/simulator/simulator.cc Thu Apr 17 13:42:25 2008 -0700
123.3 @@ -113,8 +113,8 @@
123.4 .SetParent<Object> ()
123.5 .AddConstructor<SimulatorPrivate> ()
123.6 .AddAttribute ("Scheduler",
123.7 - "XXX",
123.8 - Pointer (),
123.9 + "The Scheduler used to handle all simulation events.",
123.10 + PointerValue (),
123.11 // XXX: allow getting the scheduler too.
123.12 MakePointerAccessor (&SimulatorPrivate::SetScheduler),
123.13 MakePointerChecker<Scheduler> ())
124.1 --- a/src/simulator/time.cc Mon Apr 14 16:19:17 2008 -0700
124.2 +++ b/src/simulator/time.cc Thu Apr 17 13:42:25 2008 -0700
124.3 @@ -41,7 +41,7 @@
124.4
124.5 static GlobalValue g_precisionDefaultValue ("TimeStepPrecision",
124.6 "The time unit of the internal 64 bit integer time.",
124.7 - Enum (NS),
124.8 + EnumValue (NS),
124.9 MakeEnumChecker (NS, "NS",
124.10 S, "S",
124.11 MS, "MS",
124.12 @@ -53,14 +53,15 @@
124.13 precision_t
124.14 Get (void)
124.15 {
124.16 - Enum v = g_precisionDefaultValue.GetValue ();
124.17 + EnumValue v;
124.18 + g_precisionDefaultValue.GetValue (v);
124.19 return (precision_t) v.Get ();
124.20 }
124.21
124.22 void
124.23 Set (precision_t precision)
124.24 {
124.25 - g_precisionDefaultValue.SetValue (Enum (precision));
124.26 + g_precisionDefaultValue.SetValue (EnumValue (precision));
124.27 g_tsPrecFactor = (uint64_t)pow(10, precision);
124.28 }
124.29
124.30 @@ -301,20 +302,6 @@
124.31 return unitValue;
124.32 }
124.33
124.34 -TimeUnit<1>::TimeUnit (Attribute value)
124.35 -{
124.36 - const TimeValue *v = value.DynCast<const TimeValue *> ();
124.37 - if (v == 0)
124.38 - {
124.39 - NS_FATAL_ERROR ("Unexpected type of value. Expected \"TimeValue\"");
124.40 - }
124.41 - *this = v->Get ();
124.42 -}
124.43 -TimeUnit<1>::operator Attribute () const
124.44 -{
124.45 - return Attribute (ns3::Create<TimeValue> (*this));
124.46 -}
124.47 -
124.48 ATTRIBUTE_VALUE_IMPLEMENT (Time);
124.49 ATTRIBUTE_CHECKER_IMPLEMENT (Time);
124.50
124.51 @@ -491,12 +478,12 @@
124.52
124.53 TimeStepPrecision::Set (TimeStepPrecision::NS);
124.54
124.55 - Config::SetGlobal ("TimeStepPrecision", String ("S"));
124.56 - Config::SetGlobal ("TimeStepPrecision", String ("MS"));
124.57 - Config::SetGlobal ("TimeStepPrecision", String ("US"));
124.58 - Config::SetGlobal ("TimeStepPrecision", String ("NS"));
124.59 - Config::SetGlobal ("TimeStepPrecision", String ("PS"));
124.60 - Config::SetGlobal ("TimeStepPrecision", String ("FS"));
124.61 + Config::SetGlobal ("TimeStepPrecision", StringValue ("S"));
124.62 + Config::SetGlobal ("TimeStepPrecision", StringValue ("MS"));
124.63 + Config::SetGlobal ("TimeStepPrecision", StringValue ("US"));
124.64 + Config::SetGlobal ("TimeStepPrecision", StringValue ("NS"));
124.65 + Config::SetGlobal ("TimeStepPrecision", StringValue ("PS"));
124.66 + Config::SetGlobal ("TimeStepPrecision", StringValue ("FS"));
124.67
124.68
124.69 Time tooBig = TimeStep (0x8000000000000000LL);
125.1 --- a/tutorial/tutorial-bus-network.cc Mon Apr 14 16:19:17 2008 -0700
125.2 +++ b/tutorial/tutorial-bus-network.cc Thu Apr 17 13:42:25 2008 -0700
125.3 @@ -40,8 +40,8 @@
125.4 internet.Install (n);
125.5
125.6 CsmaHelper csma;
125.7 - csma.SetChannelParameter ("BitRate", DataRate(10000000));
125.8 - csma.SetChannelParameter ("Delay", MilliSeconds(20));
125.9 + csma.SetChannelParameter ("BitRate", StringValue ("10Mbps"));
125.10 + csma.SetChannelParameter ("Delay", StringValue ("10ms"));
125.11 NetDeviceContainer nd = csma.Install (n);
125.12
125.13 Ipv4AddressHelper ipv4;
125.14 @@ -51,9 +51,9 @@
125.15 uint32_t port = 7;
125.16 UdpEchoClientHelper client;
125.17 client.SetRemote (i.GetAddress (1), port);
125.18 - client.SetAppAttribute ("MaxPackets", Uinteger (1));
125.19 - client.SetAppAttribute ("Interval", Seconds (1.0));
125.20 - client.SetAppAttribute ("PacketSize", Uinteger (1024));
125.21 + client.SetAppAttribute ("MaxPackets", UintegerValue (1));
125.22 + client.SetAppAttribute ("Interval", StringValue ("1s"));
125.23 + client.SetAppAttribute ("PacketSize", UintegerValue (1024));
125.24 ApplicationContainer apps = client.Install (n.Get (0));
125.25 apps.Start (Seconds (2.0));
125.26 apps.Stop (Seconds (10.0));
126.1 --- a/tutorial/tutorial-csma-echo-ascii-trace.cc Mon Apr 14 16:19:17 2008 -0700
126.2 +++ b/tutorial/tutorial-csma-echo-ascii-trace.cc Thu Apr 17 13:42:25 2008 -0700
126.3 @@ -38,8 +38,8 @@
126.4 internet.Install (n);
126.5
126.6 CsmaHelper csma;
126.7 - csma.SetChannelParameter ("BitRate", DataRate (5000000));
126.8 - csma.SetChannelParameter ("Delay", MilliSeconds (2));
126.9 + csma.SetChannelParameter ("BitRate", StringValue ("5Mpbs"));
126.10 + csma.SetChannelParameter ("Delay", StringValue ("2ms"));
126.11 NetDeviceContainer nd = csma.Install (n);
126.12
126.13 Ipv4AddressHelper ipv4;
126.14 @@ -50,9 +50,9 @@
126.15
126.16 UdpEchoClientHelper client;
126.17 client.SetRemote (i.GetAddress (1), port);
126.18 - client.SetAppAttribute ("MaxPackets", Uinteger (1));
126.19 - client.SetAppAttribute ("Interval", Seconds (1.0));
126.20 - client.SetAppAttribute ("PacketSize", Uinteger (1024));
126.21 + client.SetAppAttribute ("MaxPackets", UintegerValue (1));
126.22 + client.SetAppAttribute ("Interval", StringValue ("1s"));
126.23 + client.SetAppAttribute ("PacketSize", UintegerValue (1024));
126.24 ApplicationContainer apps = client.Install (n.Get (0));
126.25 apps.Start (Seconds (2.0));
126.26 apps.Stop (Seconds (10.0));
127.1 --- a/tutorial/tutorial-csma-echo-pcap-trace.cc Mon Apr 14 16:19:17 2008 -0700
127.2 +++ b/tutorial/tutorial-csma-echo-pcap-trace.cc Thu Apr 17 13:42:25 2008 -0700
127.3 @@ -36,8 +36,8 @@
127.4 internet.Install (n);
127.5
127.6 CsmaHelper csma;
127.7 - csma.SetChannelParameter ("BitRate", DataRate (5000000));
127.8 - csma.SetChannelParameter ("Delay", MilliSeconds (2));
127.9 + csma.SetChannelParameter ("BitRate", StringValue ("5Mbps"));
127.10 + csma.SetChannelParameter ("Delay", StringValue ("2ms"));
127.11 NetDeviceContainer nd = csma.Install (n);
127.12
127.13 Ipv4AddressHelper ipv4;
127.14 @@ -48,9 +48,9 @@
127.15
127.16 UdpEchoClientHelper client;
127.17 client.SetRemote (i.GetAddress (1), port);
127.18 - client.SetAppAttribute ("MaxPackets", Uinteger (1));
127.19 - client.SetAppAttribute ("Interval", Seconds (1.0));
127.20 - client.SetAppAttribute ("PacketSize", Uinteger (1024));
127.21 + client.SetAppAttribute ("MaxPackets", UintegerValue (1));
127.22 + client.SetAppAttribute ("Interval", StringValue ("2s"));
127.23 + client.SetAppAttribute ("PacketSize", UintegerValue (1024));
127.24 ApplicationContainer apps = client.Install (n.Get (0));
127.25 apps.Start (Seconds (2.0));
127.26 apps.Stop (Seconds (10.0));
128.1 --- a/tutorial/tutorial-csma-echo.cc Mon Apr 14 16:19:17 2008 -0700
128.2 +++ b/tutorial/tutorial-csma-echo.cc Thu Apr 17 13:42:25 2008 -0700
128.3 @@ -36,8 +36,8 @@
128.4 internet.Install (n);
128.5
128.6 CsmaHelper csma;
128.7 - csma.SetChannelParameter ("BitRate", DataRate (5000000));
128.8 - csma.SetChannelParameter ("Delay", MilliSeconds (2));
128.9 + csma.SetChannelParameter ("BitRate", StringValue ("5Mbps"));
128.10 + csma.SetChannelParameter ("Delay", StringValue ("2ms"));
128.11 NetDeviceContainer nd = csma.Install (n);
128.12
128.13 Ipv4AddressHelper ipv4;
128.14 @@ -48,9 +48,9 @@
128.15
128.16 UdpEchoClientHelper client;
128.17 client.SetRemote (i.GetAddress (1), port);
128.18 - client.SetAppAttribute ("MaxPackets", Uinteger (1));
128.19 - client.SetAppAttribute ("Interval", Seconds (1.0));
128.20 - client.SetAppAttribute ("PacketSize", Uinteger (1024));
128.21 + client.SetAppAttribute ("MaxPackets", UintegerValue (1));
128.22 + client.SetAppAttribute ("Interval", StringValue ("1s"));
128.23 + client.SetAppAttribute ("PacketSize", UintegerValue (1024));
128.24 ApplicationContainer apps = client.Install (n.Get (0));
128.25 apps.Start (Seconds (2.0));
128.26 apps.Stop (Seconds (10.0));
129.1 --- a/tutorial/tutorial-linear-dumbbell.cc Mon Apr 14 16:19:17 2008 -0700
129.2 +++ b/tutorial/tutorial-linear-dumbbell.cc Thu Apr 17 13:42:25 2008 -0700
129.3 @@ -53,8 +53,8 @@
129.4 internet.Install (lan1);
129.5
129.6 CsmaHelper csma;
129.7 - csma.SetChannelParameter ("BitRate", DataRate (10000000));
129.8 - csma.SetChannelParameter ("Delay", MilliSeconds (2));
129.9 + csma.SetChannelParameter ("BitRate", StringValue ("10Mbps"));
129.10 + csma.SetChannelParameter ("Delay", StringValue ("2ms"));
129.11 NetDeviceContainer dev1 = csma.Install (lan1);
129.12 Ipv4AddressHelper ipv4;
129.13 ipv4.SetBase ("10.1.1.0", "255.255.255.0");
129.14 @@ -78,8 +78,8 @@
129.15 //
129.16 NodeContainer backbone = NodeContainer (lan1.Get (3), lan2.Get (0));
129.17 PointToPointHelper p2p;
129.18 - p2p.SetChannelParameter ("BitRate", DataRate (38400));
129.19 - p2p.SetChannelParameter ("Delay", MilliSeconds (20));
129.20 + p2p.SetChannelParameter ("BitRate", StringValue ("38400bps"));
129.21 + p2p.SetChannelParameter ("Delay", StringValue ("20ms"));
129.22 NetDeviceContainer dev3 = p2p.Install (backbone);
129.23 ipv4.SetBase ("10.1.3.0", "255.255.255.0");
129.24 ipv4.Assign (dev3);
129.25 @@ -95,9 +95,9 @@
129.26
129.27 UdpEchoClientHelper client;
129.28 client.SetRemote (i2.GetAddress (0), port);
129.29 - client.SetAppAttribute ("MaxPackets", Uinteger (100));
129.30 - client.SetAppAttribute ("Interval", Seconds (0.01));
129.31 - client.SetAppAttribute ("PacketSize", Uinteger (1024));
129.32 + client.SetAppAttribute ("MaxPackets", UintegerValue (100));
129.33 + client.SetAppAttribute ("Interval", StringValue ("10ms"));
129.34 + client.SetAppAttribute ("PacketSize", UintegerValue (1024));
129.35 ApplicationContainer apps = client.Install (lan1.Get (0));
129.36 apps.Start (Seconds(2.));
129.37 apps.Stop (Seconds (10.0));
130.1 --- a/tutorial/tutorial-point-to-point.cc Mon Apr 14 16:19:17 2008 -0700
130.2 +++ b/tutorial/tutorial-point-to-point.cc Thu Apr 17 13:42:25 2008 -0700
130.3 @@ -45,8 +45,8 @@
130.4 internet.Install (n);
130.5
130.6 PointToPointHelper p2p;
130.7 - p2p.SetChannelParameter ("BitRate", DataRate (38400));
130.8 - p2p.SetChannelParameter ("Delay", MilliSeconds (20));
130.9 + p2p.SetChannelParameter ("BitRate", StringValue ("38400bps"));
130.10 + p2p.SetChannelParameter ("Delay", StringValue ("20ms"));
130.11 NetDeviceContainer nd = p2p.Install (n);
130.12
130.13 Ipv4AddressHelper ipv4;
130.14 @@ -56,9 +56,9 @@
130.15 uint16_t port = 7;
130.16 UdpEchoClientHelper client;
130.17 client.SetRemote (i.GetAddress (1), port);
130.18 - client.SetAppAttribute ("MaxPackets", Uinteger (1));
130.19 - client.SetAppAttribute ("Interval", Seconds (1.0));
130.20 - client.SetAppAttribute ("PacketSize", Uinteger (1024));
130.21 + client.SetAppAttribute ("MaxPackets", UintegerValue (1));
130.22 + client.SetAppAttribute ("Interval", StringValue ("1s"));
130.23 + client.SetAppAttribute ("PacketSize", UintegerValue (1024));
130.24 ApplicationContainer apps = client.Install (n.Get (0));
130.25 apps.Start (Seconds (2.0));
130.26 apps.Stop (Seconds (10.0));
131.1 --- a/tutorial/tutorial-star-routing.cc Mon Apr 14 16:19:17 2008 -0700
131.2 +++ b/tutorial/tutorial-star-routing.cc Thu Apr 17 13:42:25 2008 -0700
131.3 @@ -56,8 +56,8 @@
131.4 internet.Install (n);
131.5
131.6 PointToPointHelper p2p;
131.7 - p2p.SetChannelParameter ("BitRate", DataRate (38400));
131.8 - p2p.SetChannelParameter ("Delay", MilliSeconds (20));
131.9 + p2p.SetChannelParameter ("BitRate", StringValue ("38400bps"));
131.10 + p2p.SetChannelParameter ("Delay", StringValue ("20ms"));
131.11
131.12 NetDeviceContainer d01 = p2p.Install (n01);
131.13 NetDeviceContainer d02 = p2p.Install (n02);
131.14 @@ -90,9 +90,9 @@
131.15
131.16 UdpEchoClientHelper client;
131.17 client.SetRemote (i01.GetAddress (1), port);
131.18 - client.SetAppAttribute ("MaxPackets", Uinteger (1));
131.19 - client.SetAppAttribute ("Interval", Seconds (1.0));
131.20 - client.SetAppAttribute ("PacketSize", Uinteger (1024));
131.21 + client.SetAppAttribute ("MaxPackets", UintegerValue (1));
131.22 + client.SetAppAttribute ("Interval", StringValue ("1s"));
131.23 + client.SetAppAttribute ("PacketSize", UintegerValue (1024));
131.24 apps = client.Install (n.Get (0));
131.25 apps.Start (Seconds (2.0));
131.26 apps.Stop (Seconds (10.0));
132.1 --- a/tutorial/tutorial-star.cc Mon Apr 14 16:19:17 2008 -0700
132.2 +++ b/tutorial/tutorial-star.cc Thu Apr 17 13:42:25 2008 -0700
132.3 @@ -55,8 +55,8 @@
132.4 internet.Install (n);
132.5
132.6 PointToPointHelper p2p;
132.7 - p2p.SetChannelParameter ("BitRate", DataRate (38400));
132.8 - p2p.SetChannelParameter ("Delay", MilliSeconds (20));
132.9 + p2p.SetChannelParameter ("BitRate", StringValue ("38400bps"));
132.10 + p2p.SetChannelParameter ("Delay", StringValue ("20ms"));
132.11
132.12 NetDeviceContainer d01 = p2p.Install (n01);
132.13 NetDeviceContainer d02 = p2p.Install (n02);
132.14 @@ -89,9 +89,9 @@
132.15
132.16 UdpEchoClientHelper client;
132.17 client.SetRemote (i01.GetAddress (1), port);
132.18 - client.SetAppAttribute ("MaxPackets", Uinteger (1));
132.19 - client.SetAppAttribute ("Interval", Seconds (1.0));
132.20 - client.SetAppAttribute ("PacketSize", Uinteger (1024));
132.21 + client.SetAppAttribute ("MaxPackets", UintegerValue (1));
132.22 + client.SetAppAttribute ("Interval", StringValue ("1s"));
132.23 + client.SetAppAttribute ("PacketSize", UintegerValue (1024));
132.24 apps = client.Install (n.Get (0));
132.25 apps.Start (Seconds (2.0));
132.26 apps.Stop (Seconds (10.0));