introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 27 Feb 2008 21:41:34 +0100
changeset 250250d0da37f02f
parent 2501 3eaeac1dd5ed
child 2503 e667dc0f350e
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
examples/csma-multicast.cc
examples/csma-packet-socket.cc
examples/mixed-global-routing.cc
examples/simple-alternate-routing.cc
examples/simple-error-model.cc
examples/simple-global-routing.cc
examples/simple-point-to-point-olsr.cc
examples/simple-point-to-point.cc
samples/main-grid-topology.cc
samples/main-random-topology.cc
samples/main-random-walk.cc
src/applications/onoff/onoff-application.cc
src/common/data-rate.cc
src/common/data-rate.h
src/core/attribute-helper.h
src/core/attribute-test.cc
src/core/attribute.cc
src/core/attribute.h
src/core/object-factory.cc
src/core/object-factory.h
src/core/object.cc
src/core/string.cc
src/core/string.h
src/core/wscript
src/devices/csma/csma-ipv4-topology.cc
src/devices/point-to-point/point-to-point-net-device.cc
src/devices/point-to-point/point-to-point-net-device.h
src/devices/point-to-point/point-to-point-topology.cc
src/node/ipv4-address.cc
tutorial/point-to-point-ipv4-topology.cc
utils/print-introspected-doxygen.cc
     1.1 --- a/examples/csma-multicast.cc	Wed Feb 27 20:48:43 2008 +0100
     1.2 +++ b/examples/csma-multicast.cc	Wed Feb 27 21:41:34 2008 +0100
     1.3 @@ -289,7 +289,7 @@
     1.4                                          "Protocol", TypeId::LookupByName ("Udp"),
     1.5                                          "OnTime", ConstantVariable(1), 
     1.6                                          "OffTime", ConstantVariable(0),
     1.7 -                                        "DataRate", MakeDataRate ("255b/s"),
     1.8 +                                        "DataRate", DataRate ("255b/s"),
     1.9                                          "PacketSize", Uinteger (128));
    1.10    n0->AddApplication (ooff);
    1.11  //
     2.1 --- a/examples/csma-packet-socket.cc	Wed Feb 27 20:48:43 2008 +0100
     2.2 +++ b/examples/csma-packet-socket.cc	Wed Feb 27 21:41:34 2008 +0100
     2.3 @@ -38,6 +38,7 @@
     2.4  #include "ns3/ptr.h"
     2.5  #include "ns3/random-variable.h"
     2.6  #include "ns3/log.h"
     2.7 +#include "ns3/string.h"
     2.8  
     2.9  #include "ns3/simulator.h"
    2.10  #include "ns3/nstime.h"
    2.11 @@ -63,7 +64,7 @@
    2.12  {
    2.13    Ptr<CsmaNetDevice> device = CreateObjectWith<CsmaNetDevice> ("Node", node, 
    2.14                                                                 "Address", Mac48Address::Allocate (),
    2.15 -                                                               "EncapsulationMode", "Llc");
    2.16 +                                                               "EncapsulationMode", String ("Llc"));
    2.17    node->AddDevice (device);
    2.18    device->Attach (channel);
    2.19    Ptr<Queue> queue = Queue::CreateDefault ();
     3.1 --- a/examples/mixed-global-routing.cc	Wed Feb 27 20:48:43 2008 +0100
     3.2 +++ b/examples/mixed-global-routing.cc	Wed Feb 27 21:41:34 2008 +0100
     3.3 @@ -113,7 +113,7 @@
     3.4    DefaultValue::Bind ("Queue", "DropTailQueue");
     3.5  
     3.6    Config::SetDefault ("OnOffApplication::PacketSize", Uinteger (210));
     3.7 -  Config::SetDefault ("OnOffApplication::DataRate", MakeDataRate ("448kb/s"));
     3.8 +  Config::SetDefault ("OnOffApplication::DataRate", DataRate ("448kb/s"));
     3.9  
    3.10    // Allow the user to override any of the defaults and the above
    3.11    // Bind ()s at run-time, via command-line arguments
    3.12 @@ -198,7 +198,7 @@
    3.13                                          "Protocol", TypeId::LookupByName ("Udp"),
    3.14                                          "OnTime", ConstantVariable (1), 
    3.15                                          "OffTime", ConstantVariable (0),
    3.16 -                                        "DataRate", MakeDataRate("300bps"),
    3.17 +                                        "DataRate", DataRate("300bps"),
    3.18                                          "PacketSize", Uinteger (50));
    3.19    n0->AddApplication (ooff);
    3.20    // Start the application
     4.1 --- a/examples/simple-alternate-routing.cc	Wed Feb 27 20:48:43 2008 +0100
     4.2 +++ b/examples/simple-alternate-routing.cc	Wed Feb 27 21:41:34 2008 +0100
     4.3 @@ -108,7 +108,7 @@
     4.4    DefaultValue::Bind ("Queue", "DropTailQueue");
     4.5  
     4.6    Config::SetDefault ("OnOffApplication::PacketSize", Uinteger (210));
     4.7 -  Config::SetDefault ("OnOffApplication::DataRate", MakeDataRate ("300b/s"));
     4.8 +  Config::SetDefault ("OnOffApplication::DataRate", DataRate ("300b/s"));
     4.9  
    4.10    // The below metric, if set to 3 or higher, will cause packets between
    4.11    // n1 and n3 to take the 2-hop route through n2
     5.1 --- a/examples/simple-error-model.cc	Wed Feb 27 20:48:43 2008 +0100
     5.2 +++ b/examples/simple-error-model.cc	Wed Feb 27 21:41:34 2008 +0100
     5.3 @@ -45,6 +45,7 @@
     5.4  #include "ns3/ptr.h"
     5.5  #include "ns3/config.h"
     5.6  #include "ns3/uinteger.h"
     5.7 +#include "ns3/string.h"
     5.8  
     5.9  #include "ns3/simulator.h"
    5.10  #include "ns3/nstime.h"
    5.11 @@ -83,10 +84,10 @@
    5.12  
    5.13    // Set a few parameters
    5.14    Config::SetDefault ("RateErrorModel::ErrorRate", Double (0.01));
    5.15 -  Config::SetDefault ("RateErrorModel::ErrorUnit", "EU_PKT");
    5.16 +  Config::SetDefault ("RateErrorModel::ErrorUnit", String ("EU_PKT"));
    5.17    
    5.18    Config::SetDefault ("OnOffApplication::PacketSize", Uinteger (210));
    5.19 -  Config::SetDefault ("OnOffApplication::DataRate", MakeDataRate ("448kb/s"));
    5.20 +  Config::SetDefault ("OnOffApplication::DataRate", DataRate ("448kb/s"));
    5.21  
    5.22  
    5.23    // Allow the user to override any of the defaults and the above
     6.1 --- a/examples/simple-global-routing.cc	Wed Feb 27 20:48:43 2008 +0100
     6.2 +++ b/examples/simple-global-routing.cc	Wed Feb 27 21:41:34 2008 +0100
     6.3 @@ -113,7 +113,7 @@
     6.4    DefaultValue::Bind ("Queue", "DropTailQueue");
     6.5  
     6.6    Config::SetDefault ("OnOffApplication::PacketSize", Uinteger (210));
     6.7 -  Config::SetDefault ("OnOffApplication::DataRate", MakeDataRate ("448kb/s"));
     6.8 +  Config::SetDefault ("OnOffApplication::DataRate", DataRate ("448kb/s"));
     6.9  
    6.10    //DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30);   
    6.11  
     7.1 --- a/examples/simple-point-to-point-olsr.cc	Wed Feb 27 20:48:43 2008 +0100
     7.2 +++ b/examples/simple-point-to-point-olsr.cc	Wed Feb 27 21:41:34 2008 +0100
     7.3 @@ -44,6 +44,7 @@
     7.4  #include "ns3/ptr.h"
     7.5  #include "ns3/random-variable.h"
     7.6  #include "ns3/config.h"
     7.7 +#include "ns3/string.h"
     7.8  
     7.9  #include "ns3/simulator.h"
    7.10  #include "ns3/nstime.h"
    7.11 @@ -101,8 +102,8 @@
    7.12  
    7.13    // Set up some default values for the simulation.
    7.14  
    7.15 -  Config::SetDefault ("OnOffApplication::PacketSize", "210");
    7.16 -  Config::SetDefault ("OnOffApplication::DataRate", "448kb/s");
    7.17 +  Config::SetDefault ("OnOffApplication::PacketSize", String ("210"));
    7.18 +  Config::SetDefault ("OnOffApplication::DataRate", String ("448kb/s"));
    7.19  
    7.20    //DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30);   
    7.21  
     8.1 --- a/examples/simple-point-to-point.cc	Wed Feb 27 20:48:43 2008 +0100
     8.2 +++ b/examples/simple-point-to-point.cc	Wed Feb 27 21:41:34 2008 +0100
     8.3 @@ -44,6 +44,7 @@
     8.4  #include "ns3/ptr.h"
     8.5  #include "ns3/random-variable.h"
     8.6  #include "ns3/config.h"
     8.7 +#include "ns3/string.h"
     8.8  
     8.9  #include "ns3/simulator.h"
    8.10  #include "ns3/nstime.h"
    8.11 @@ -78,8 +79,8 @@
    8.12  
    8.13    // Set up some default values for the simulation.
    8.14  
    8.15 -  Config::SetDefault ("OnOffApplication::PacketSize", "210");
    8.16 -  Config::SetDefault ("OnOffApplication::DataRate", "448kb/s");
    8.17 +  Config::SetDefault ("OnOffApplication::PacketSize", String ("210"));
    8.18 +  Config::SetDefault ("OnOffApplication::DataRate", String ("448kb/s"));
    8.19  
    8.20    // Allow the user to override any of the defaults and the above
    8.21    // Bind()s at run-time, via command-line arguments
     9.1 --- a/samples/main-grid-topology.cc	Wed Feb 27 20:48:43 2008 +0100
     9.2 +++ b/samples/main-grid-topology.cc	Wed Feb 27 21:41:34 2008 +0100
     9.3 @@ -7,6 +7,7 @@
     9.4  #include "ns3/mobility-helper.h"
     9.5  #include "ns3/uinteger.h"
     9.6  #include "ns3/double.h"
     9.7 +#include "ns3/string.h"
     9.8  
     9.9  using namespace ns3;
    9.10  
    9.11 @@ -33,7 +34,7 @@
    9.12                                   "DeltaX", Double (5.0),
    9.13                                   "DeltaY", Double (20.0),
    9.14                                   "GridWidth", Uinteger (20),
    9.15 -                                 "LayoutType", "RowFirst");
    9.16 +                                 "LayoutType", String ("RowFirst"));
    9.17    // each object will be attached a static position.
    9.18    // i.e., once set by the "position allocator", the
    9.19    // position will never change.
    10.1 --- a/samples/main-random-topology.cc	Wed Feb 27 20:48:43 2008 +0100
    10.2 +++ b/samples/main-random-topology.cc	Wed Feb 27 21:41:34 2008 +0100
    10.3 @@ -11,6 +11,7 @@
    10.4  #include "ns3/node.h"
    10.5  #include "ns3/mobility-helper.h"
    10.6  #include "ns3/node-list.h"
    10.7 +#include "ns3/string.h"
    10.8  
    10.9  using namespace ns3;
   10.10  
   10.11 @@ -37,9 +38,9 @@
   10.12    MobilityHelper mobility;
   10.13    mobility.EnableNotifier ();
   10.14    mobility.SetPositionAllocator ("RandomDiscPositionAllocator",
   10.15 -                                 "X", "100.0",
   10.16 -                                 "Y", "100.0",
   10.17 -                                 "Rho", "Uniform:0:30");
   10.18 +                                 "X", String ("100.0"),
   10.19 +                                 "Y", String ("100.0"),
   10.20 +                                 "Rho", String ("Uniform:0:30"));
   10.21    mobility.SetMobilityModel ("StaticMobilityModel");
   10.22    mobility.Layout (objects.begin (), objects.end ());
   10.23  
    11.1 --- a/samples/main-random-walk.cc	Wed Feb 27 20:48:43 2008 +0100
    11.2 +++ b/samples/main-random-walk.cc	Wed Feb 27 21:41:34 2008 +0100
    11.3 @@ -12,6 +12,7 @@
    11.4  #include "ns3/node.h"
    11.5  #include "ns3/node-list.h"
    11.6  #include "ns3/mobility-helper.h"
    11.7 +#include "ns3/string.h"
    11.8  
    11.9  using namespace ns3;
   11.10  
   11.11 @@ -44,14 +45,14 @@
   11.12    MobilityHelper mobility;
   11.13    mobility.EnableNotifier ();
   11.14    mobility.SetPositionAllocator ("RandomDiscPositionAllocator",
   11.15 -                                 "X", "100.0",
   11.16 -                                 "Y", "100.0",
   11.17 -                                 "Rho", "Uniform:0:30");
   11.18 +                                 "X", String ("100.0"),
   11.19 +                                 "Y", String ("100.0"),
   11.20 +                                 "Rho", String ("Uniform:0:30"));
   11.21    mobility.SetMobilityModel ("RandomWalk2dMobilityModel",
   11.22 -                             "Mode", "Time",
   11.23 -                             "Time", "2s",
   11.24 -                             "Speed", "Constant:1.0",
   11.25 -                             "Bounds", "0:200:0:100");
   11.26 +                             "Mode", String ("Time"),
   11.27 +                             "Time", String ("2s"),
   11.28 +                             "Speed", String ("Constant:1.0"),
   11.29 +                             "Bounds", String ("0:200:0:100"));
   11.30    mobility.Layout (NodeList::Begin (), NodeList::End ());
   11.31    NodeList::Connect ("/nodes/*/$MobilityModelNotifier/course-change", 
   11.32                       MakeCallback (&CourseChange));
    12.1 --- a/src/applications/onoff/onoff-application.cc	Wed Feb 27 20:48:43 2008 +0100
    12.2 +++ b/src/applications/onoff/onoff-application.cc	Wed Feb 27 21:41:34 2008 +0100
    12.3 @@ -52,7 +52,7 @@
    12.4      .SetParent<Application> ()
    12.5      .AddConstructor<OnOffApplication> ()
    12.6      .AddAttribute ("DataRate", "The data rate in on state.",
    12.7 -                   MakeDataRate ("500kb/s"),
    12.8 +                   DataRate ("500kb/s"),
    12.9                     MakeDataRateAccessor (&OnOffApplication::m_cbrRate),
   12.10                     MakeDataRateChecker ())
   12.11      .AddAttribute ("PacketSize", "The size of packets sent in on state",
    13.1 --- a/src/common/data-rate.cc	Wed Feb 27 20:48:43 2008 +0100
    13.2 +++ b/src/common/data-rate.cc	Wed Feb 27 21:41:34 2008 +0100
    13.3 @@ -175,15 +175,13 @@
    13.4    return m_bps;
    13.5  }
    13.6  
    13.7 -DataRate MakeDataRate (std::string rate)
    13.8 +DataRate::DataRate (std::string rate)
    13.9  {
   13.10 -  uint64_t bps;
   13.11 -  bool ok = DoParse (rate, &bps);
   13.12 +  bool ok = DoParse (rate, &m_bps);
   13.13    if (!ok)
   13.14      {
   13.15 -      NS_FATAL_ERROR ("Could not parse rate.");
   13.16 +      NS_FATAL_ERROR ("Could not parse rate: "<<rate);
   13.17      }
   13.18 -  return DataRate (bps);
   13.19  }
   13.20  
   13.21  std::ostream &operator << (std::ostream &os, const DataRate &rate)
    14.1 --- a/src/common/data-rate.h	Wed Feb 27 20:48:43 2008 +0100
    14.2 +++ b/src/common/data-rate.h	Wed Feb 27 21:41:34 2008 +0100
    14.3 @@ -58,6 +58,7 @@
    14.4     * non-trivial bitrate availiable.
    14.5     */
    14.6    DataRate (uint64_t bps);
    14.7 +  DataRate (std::string rate);
    14.8      
    14.9    bool operator <  (const DataRate& rhs) const;
   14.10    bool operator <= (const DataRate& rhs) const;
   14.11 @@ -87,8 +88,6 @@
   14.12    static uint64_t Parse(const std::string);
   14.13  };
   14.14  
   14.15 -DataRate MakeDataRate (std::string rate);
   14.16 -
   14.17  std::ostream &operator << (std::ostream &os, const DataRate &rate);
   14.18  std::istream &operator >> (std::istream &is, DataRate &rate);
   14.19  
    15.1 --- a/src/core/attribute-helper.h	Wed Feb 27 20:48:43 2008 +0100
    15.2 +++ b/src/core/attribute-helper.h	Wed Feb 27 21:41:34 2008 +0100
    15.3 @@ -1,6 +1,8 @@
    15.4  #ifndef VALUE_HELPER_H
    15.5  #define VALUE_HELPER_H
    15.6  
    15.7 +#include "attribute.h"
    15.8 +#include "object-base.h"
    15.9  #include "attribute-accessor-helper.h"
   15.10  #include <sstream>
   15.11  #include "fatal-error.h"
    16.1 --- a/src/core/attribute-test.cc	Wed Feb 27 20:48:43 2008 +0100
    16.2 +++ b/src/core/attribute-test.cc	Wed Feb 27 21:41:34 2008 +0100
    16.3 @@ -5,6 +5,7 @@
    16.4  #include "integer.h"
    16.5  #include "uinteger.h"
    16.6  #include "enum.h"
    16.7 +#include "string.h"
    16.8  #include "random-variable.h"
    16.9  #include "double.h"
   16.10  #include "object-vector.h"
   16.11 @@ -239,12 +240,12 @@
   16.12  
   16.13    AttributeList params;
   16.14    Ptr<AttributeObjectTest> p;
   16.15 -  NS_TEST_ASSERT (params.Set ("AttributeObjectTest::TestBoolName", "false"));
   16.16 +  NS_TEST_ASSERT (params.Set ("AttributeObjectTest::TestBoolName", String ("false")));
   16.17    p = CreateObject<AttributeObjectTest> (params);
   16.18    CHECK_GET_STR (p, "TestBoolName", "false");
   16.19    CHECK_GET_PARAM (p, "TestBoolName", Boolean, false);
   16.20  
   16.21 -  NS_TEST_ASSERT (p->SetAttribute("TestBoolName", "true"));
   16.22 +  NS_TEST_ASSERT (p->SetAttribute("TestBoolName", String ("true")));
   16.23    CHECK_GET_STR (p, "TestBoolName", "true");
   16.24    CHECK_GET_PARAM (p, "TestBoolName", Boolean, true);
   16.25  
   16.26 @@ -252,7 +253,7 @@
   16.27    CHECK_GET_STR (p, "TestBoolName", "false");
   16.28    CHECK_GET_PARAM (p, "TestBoolName", Boolean, false);
   16.29  
   16.30 -  p = CreateObjectWith<AttributeObjectTest> ("TestBoolName", "true");
   16.31 +  p = CreateObjectWith<AttributeObjectTest> ("TestBoolName", String ("true"));
   16.32    CHECK_GET_STR (p, "TestBoolName", "true");
   16.33    CHECK_GET_PARAM (p, "TestBoolName", Boolean, true);
   16.34  
   16.35 @@ -260,11 +261,11 @@
   16.36    CHECK_GET_STR (p, "TestBoolName", "true");
   16.37    CHECK_GET_PARAM (p, "TestBoolName", Boolean, true);
   16.38  
   16.39 -  NS_TEST_ASSERT (p->SetAttribute("TestBoolA", "false"));
   16.40 +  NS_TEST_ASSERT (p->SetAttribute("TestBoolA", String ("false")));
   16.41    CHECK_GET_STR (p, "TestBoolA", "false");
   16.42    CHECK_GET_PARAM (p, "TestBoolA", Boolean, false);
   16.43  
   16.44 -  NS_TEST_ASSERT (p->SetAttribute("TestBoolA", "true"));
   16.45 +  NS_TEST_ASSERT (p->SetAttribute("TestBoolA", String ("true")));
   16.46    CHECK_GET_STR (p, "TestBoolA", "true");
   16.47    CHECK_GET_PARAM (p, "TestBoolA", Boolean, true);
   16.48  
   16.49 @@ -289,7 +290,7 @@
   16.50    CHECK_GET_STR (p, "TestInt16", "-2");
   16.51    CHECK_GET_PARAM (p, "TestInt16", Integer, -2);
   16.52  
   16.53 -  NS_TEST_ASSERT (p->SetAttribute("TestInt16", "-5"));
   16.54 +  NS_TEST_ASSERT (p->SetAttribute("TestInt16", String ("-5")));
   16.55    CHECK_GET_STR (p, "TestInt16", "-5");
   16.56    CHECK_GET_PARAM (p, "TestInt16", Integer, -5);
   16.57  
   16.58 @@ -341,13 +342,13 @@
   16.59    NS_TEST_ASSERT (p->SetAttribute("TestUint8", Uinteger (255)));
   16.60    CHECK_GET_STR (p, "TestUint8", "255");
   16.61    CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255);
   16.62 -  NS_TEST_ASSERT (p->SetAttribute("TestUint8", "255"));
   16.63 +  NS_TEST_ASSERT (p->SetAttribute("TestUint8", String ("255")));
   16.64    CHECK_GET_STR (p, "TestUint8", "255");
   16.65    CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255);
   16.66 -  NS_TEST_ASSERT (!p->SetAttribute("TestUint8", "256"));
   16.67 +  NS_TEST_ASSERT (!p->SetAttribute("TestUint8", String ("256")));
   16.68    CHECK_GET_STR (p, "TestUint8", "255");
   16.69    CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255);
   16.70 -  NS_TEST_ASSERT (!p->SetAttribute("TestUint8", "-1"));
   16.71 +  NS_TEST_ASSERT (!p->SetAttribute("TestUint8", String ("-1")));
   16.72    CHECK_GET_STR (p, "TestUint8", "255");
   16.73    CHECK_GET_PARAM (p, "TestUint8", Uinteger, 255);
   16.74    NS_TEST_ASSERT (!p->SetAttribute("TestUint8", Uinteger ((uint64_t)-1)));
   16.75 @@ -363,10 +364,10 @@
   16.76    NS_TEST_ASSERT (p->SetAttribute("TestEnum", Enum (AttributeObjectTest::TEST_C)));
   16.77    CHECK_GET_STR (p, "TestEnum", "TestC");
   16.78    CHECK_GET_PARAM (p, "TestEnum", Enum, AttributeObjectTest::TEST_C);
   16.79 -  NS_TEST_ASSERT (p->SetAttribute("TestEnum", "TestB"));
   16.80 +  NS_TEST_ASSERT (p->SetAttribute("TestEnum", String ("TestB")));
   16.81    CHECK_GET_STR (p, "TestEnum", "TestB");
   16.82    CHECK_GET_PARAM (p, "TestEnum", Enum, AttributeObjectTest::TEST_B);
   16.83 -  NS_TEST_ASSERT (!p->SetAttribute("TestEnum", "TestD"));
   16.84 +  NS_TEST_ASSERT (!p->SetAttribute("TestEnum", String ("TestD")));
   16.85    CHECK_GET_STR (p, "TestEnum", "TestB");
   16.86    CHECK_GET_PARAM (p, "TestEnum", Enum, AttributeObjectTest::TEST_B);
   16.87    NS_TEST_ASSERT (!p->SetAttribute("TestEnum", Enum (5)));
   16.88 @@ -407,12 +408,12 @@
   16.89      NS_TEST_ASSERT_EQUAL (vector.GetN (), 2);
   16.90    }
   16.91  
   16.92 -  NS_TEST_ASSERT (AttributeList::GetGlobal ()->Set ("AttributeObjectTest::TestBoolName", "true"));
   16.93 +  NS_TEST_ASSERT (AttributeList::GetGlobal ()->Set ("AttributeObjectTest::TestBoolName", String ("true")));
   16.94    p = CreateObjectWith<AttributeObjectTest> ();
   16.95    Boolean boolV = p->GetAttribute ("TestBoolName");
   16.96    NS_TEST_ASSERT_EQUAL (boolV, Boolean (true));
   16.97  
   16.98 -  NS_TEST_ASSERT (AttributeList::GetGlobal ()->Set ("AttributeObjectTest::TestBoolName", "false"));
   16.99 +  NS_TEST_ASSERT (AttributeList::GetGlobal ()->Set ("AttributeObjectTest::TestBoolName", String ("false")));
  16.100    p = CreateObjectWith<AttributeObjectTest> ();
  16.101    boolV = p->GetAttribute ("TestBoolName");
  16.102    NS_TEST_ASSERT_EQUAL (boolV, Boolean (false));
    17.1 --- a/src/core/attribute.cc	Wed Feb 27 20:48:43 2008 +0100
    17.2 +++ b/src/core/attribute.cc	Wed Feb 27 21:41:34 2008 +0100
    17.3 @@ -113,14 +113,6 @@
    17.4    return m_value->DeserializeFromString (value, checker);
    17.5  }
    17.6  
    17.7 -Attribute::Attribute (const char *value)
    17.8 -  : m_value (new StringValue (value))
    17.9 -{}
   17.10 -Attribute::Attribute (std::string value)
   17.11 -  : m_value (new StringValue (value))
   17.12 -{}
   17.13 -
   17.14 -
   17.15  AttributeAccessor::AttributeAccessor ()
   17.16    : m_count (1)
   17.17  {}
   17.18 @@ -161,53 +153,6 @@
   17.19  AttributeChecker::~AttributeChecker ()
   17.20  {}
   17.21  
   17.22 -StringValue::StringValue (const char *value)
   17.23 -  : m_value (value)
   17.24 -{}
   17.25 -StringValue::StringValue (std::string value)
   17.26 -  : m_value (value)
   17.27 -{}
   17.28 -void 
   17.29 -StringValue::Set (std::string value)
   17.30 -{
   17.31 -  m_value = value;
   17.32 -}
   17.33 -std::string 
   17.34 -StringValue::Get (void) const
   17.35 -{
   17.36 -  return m_value;
   17.37 -}
   17.38 -Attribute 
   17.39 -StringValue::Copy (void) const
   17.40 -{
   17.41 -  return Attribute::Create<StringValue> (*this);
   17.42 -}
   17.43 -std::string 
   17.44 -StringValue::SerializeToString (Ptr<const AttributeChecker> checker) const
   17.45 -{
   17.46 -  return m_value;
   17.47 -}
   17.48 -bool 
   17.49 -StringValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
   17.50 -{
   17.51 -  m_value = value;
   17.52 -  return true;
   17.53 -}
   17.54 -StringValue::StringValue (Attribute value)
   17.55 -{
   17.56 -  const StringValue *v = value.DynCast<const StringValue *> ();
   17.57 -  if (v == 0)
   17.58 -    {
   17.59 -      NS_FATAL_ERROR ("Expected value of type String.");
   17.60 -    }
   17.61 -  m_value = v->Get ();
   17.62 -}
   17.63 -StringValue::operator Attribute () const
   17.64 -{
   17.65 -  return Attribute::Create<StringValue> (*this);
   17.66 -}
   17.67 -
   17.68 -
   17.69  std::string 
   17.70  PtrValueBase::SerializeToString (Ptr<const AttributeChecker> checker) const
   17.71  {
    18.1 --- a/src/core/attribute.h	Wed Feb 27 20:48:43 2008 +0100
    18.2 +++ b/src/core/attribute.h	Wed Feb 27 21:41:34 2008 +0100
    18.3 @@ -53,8 +53,6 @@
    18.4    template <typename T>
    18.5    operator Ptr<T> ();
    18.6  
    18.7 -  Attribute (const char *value);
    18.8 -  Attribute (std::string value);
    18.9  private:
   18.10    Attribute (AttributeValue *value);
   18.11    AttributeValue *m_value;
   18.12 @@ -120,29 +118,6 @@
   18.13  namespace ns3 {
   18.14  
   18.15  /********************************************************
   18.16 - *   A class used to hold std::string values.
   18.17 - ********************************************************/
   18.18 -
   18.19 -class StringValue : public AttributeValue
   18.20 -{
   18.21 -public:
   18.22 -  StringValue (const char *value);
   18.23 -  StringValue (std::string value);
   18.24 -  void Set (std::string value);
   18.25 -  std::string Get (void) const;
   18.26 -
   18.27 -  virtual Attribute Copy (void) const;
   18.28 -  virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
   18.29 -  virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
   18.30 -
   18.31 -  StringValue (Attribute value);
   18.32 -  operator Attribute () const;
   18.33 -private:
   18.34 -  std::string m_value;
   18.35 -};
   18.36 -
   18.37 -
   18.38 -/********************************************************
   18.39   *   The class used to access the pointer stored in a
   18.40   *   PtrValue<T> AttributeValue instance.
   18.41   ********************************************************/
    19.1 --- a/src/core/object-factory.cc	Wed Feb 27 20:48:43 2008 +0100
    19.2 +++ b/src/core/object-factory.cc	Wed Feb 27 21:41:34 2008 +0100
    19.3 @@ -27,12 +27,6 @@
    19.4    m_parameters.SetWithTid (m_tid, name, value);
    19.5  }
    19.6  
    19.7 -void 
    19.8 -ObjectFactory::Set (std::string name, std::string value)
    19.9 -{
   19.10 -  m_parameters.SetWithTid (m_tid, name, value);
   19.11 -}
   19.12 -
   19.13  TypeId 
   19.14  ObjectFactory::GetTypeId (void) const
   19.15  {
    20.1 --- a/src/core/object-factory.h	Wed Feb 27 20:48:43 2008 +0100
    20.2 +++ b/src/core/object-factory.h	Wed Feb 27 21:41:34 2008 +0100
    20.3 @@ -15,7 +15,6 @@
    20.4    void SetTypeId (std::string tid);
    20.5    void SetTypeId (const char *tid);
    20.6    void Set (std::string name, Attribute value);
    20.7 -  void Set (std::string name, std::string value);
    20.8  
    20.9    TypeId GetTypeId (void) const;
   20.10  
    21.1 --- a/src/core/object.cc	Wed Feb 27 20:48:43 2008 +0100
    21.2 +++ b/src/core/object.cc	Wed Feb 27 21:41:34 2008 +0100
    21.3 @@ -25,6 +25,7 @@
    21.4  #include "attribute.h"
    21.5  #include "trace-source-accessor.h"
    21.6  #include "log.h"
    21.7 +#include "string.h"
    21.8  #include <vector>
    21.9  #include <sstream>
   21.10  
   21.11 @@ -860,7 +861,7 @@
   21.12          }
   21.13        // attempt to convert back to value.
   21.14        Attribute v = info->initialValue.Copy ();
   21.15 -      ok = v.DeserializeFromString (str->Get (), info->checker);
   21.16 +      ok = v.DeserializeFromString (str->Get ().Get (), info->checker);
   21.17        if (!ok)
   21.18          {
   21.19            return false;
   21.20 @@ -1087,7 +1088,7 @@
   21.21          }
   21.22        // attempt to convert back from string.
   21.23        Attribute v = initialValue.Copy ();
   21.24 -      ok = v.DeserializeFromString (str->Get (), checker);
   21.25 +      ok = v.DeserializeFromString (str->Get ().Get (), checker);
   21.26        if (!ok)
   21.27          {
   21.28            return false;
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/src/core/string.cc	Wed Feb 27 21:41:34 2008 +0100
    22.3 @@ -0,0 +1,45 @@
    22.4 +#include "string.h"
    22.5 +
    22.6 +namespace ns3 {
    22.7 +
    22.8 +String::String ()
    22.9 +  : m_value ()
   22.10 +{}
   22.11 +String::String (const char *value)
   22.12 +  : m_value (value)
   22.13 +{}
   22.14 +String::String (std::string value)
   22.15 +  : m_value (value)
   22.16 +{}
   22.17 +void 
   22.18 +String::Set (std::string value)
   22.19 +{
   22.20 +  m_value = value;
   22.21 +}
   22.22 +void 
   22.23 +String::Set (const char *value)
   22.24 +{
   22.25 +  m_value = value;
   22.26 +}
   22.27 +std::string 
   22.28 +String::Get (void) const
   22.29 +{
   22.30 +  return m_value;
   22.31 +}
   22.32 +
   22.33 +std::ostream & operator << (std::ostream &os, const String &value)
   22.34 +{
   22.35 +  os << value.Get ();
   22.36 +  return os;
   22.37 +}
   22.38 +std::istream &operator >> (std::istream &is, String &value)
   22.39 +{
   22.40 +  std::string str;
   22.41 +  is >> str;
   22.42 +  value = String (str);
   22.43 +  return is;
   22.44 +}
   22.45 +
   22.46 +VALUE_HELPER_CPP (String);
   22.47 +
   22.48 +} // namespace ns3
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/src/core/string.h	Wed Feb 27 21:41:34 2008 +0100
    23.3 @@ -0,0 +1,32 @@
    23.4 +#ifndef NS3_STRING_H
    23.5 +#define NS3_STRING_H
    23.6 +
    23.7 +#include <string>
    23.8 +#include "attribute-helper.h"
    23.9 +
   23.10 +namespace ns3 {
   23.11 +
   23.12 +class String
   23.13 +{
   23.14 +public:
   23.15 +  String ();
   23.16 +  String (const char *value);
   23.17 +  String (std::string value);
   23.18 +  void Set (std::string value);
   23.19 +  void Set (const char *value);
   23.20 +  std::string Get (void) const;
   23.21 +
   23.22 +  VALUE_HELPER_HEADER_1 (String);
   23.23 +private:
   23.24 +  std::string m_value;
   23.25 +};
   23.26 +
   23.27 +std::ostream & operator << (std::ostream &os, const String &value);
   23.28 +std::istream &operator >> (std::istream &is, String &value);
   23.29 +
   23.30 +VALUE_HELPER_HEADER_2 (String);
   23.31 +
   23.32 +} // namespace ns3
   23.33 +
   23.34 +
   23.35 +#endif /* NS3_STRING_H */
    24.1 --- a/src/core/wscript	Wed Feb 27 20:48:43 2008 +0100
    24.2 +++ b/src/core/wscript	Wed Feb 27 21:41:34 2008 +0100
    24.3 @@ -60,6 +60,7 @@
    24.4          'uinteger.cc',
    24.5          'enum.cc',
    24.6          'double.cc',
    24.7 +        'string.cc',
    24.8          'object-factory.cc',
    24.9          'object-vector.cc',
   24.10          'global-value.cc',
   24.11 @@ -117,6 +118,7 @@
   24.12          'uinteger.h',
   24.13          'double.h',
   24.14          'enum.h',
   24.15 +        'string.h',
   24.16          'object-factory.h',
   24.17          'attribute-helper.h',
   24.18          'global-value.h',
    25.1 --- a/src/devices/csma/csma-ipv4-topology.cc	Wed Feb 27 20:48:43 2008 +0100
    25.2 +++ b/src/devices/csma/csma-ipv4-topology.cc	Wed Feb 27 21:41:34 2008 +0100
    25.3 @@ -26,6 +26,7 @@
    25.4  #include "ns3/ipv4-address.h"
    25.5  #include "ns3/ipv4.h"
    25.6  #include "ns3/queue.h"
    25.7 +#include "ns3/string.h"
    25.8  
    25.9  #include "csma-channel.h"
   25.10  #include "csma-net-device.h"
   25.11 @@ -44,7 +45,7 @@
   25.12    // assume full-duplex
   25.13    Ptr<CsmaNetDevice> nd = CreateObjectWith<CsmaNetDevice> ("Node", node, 
   25.14                                                             "Address", addr, 
   25.15 -                                                           "EncapsulationMode", "IpArp");
   25.16 +                                                           "EncapsulationMode", String ("IpArp"));
   25.17    node->AddDevice (nd);
   25.18  
   25.19    nd->AddQueue(q);
   25.20 @@ -62,7 +63,7 @@
   25.21  
   25.22    Ptr<CsmaNetDevice> nd0 = CreateObjectWith<CsmaNetDevice> ("Node", n1, 
   25.23                                                              "Address", addr,
   25.24 -                                                            "EncapsulationMode", "Llc");
   25.25 +                                                            "EncapsulationMode", String ("Llc"));
   25.26    n1->AddDevice (nd0);
   25.27    nd0->SetSendEnable (true);
   25.28    nd0->SetReceiveEnable (false);
   25.29 @@ -71,7 +72,7 @@
   25.30  
   25.31    Ptr<CsmaNetDevice> nd1 = CreateObjectWith<CsmaNetDevice> ("Node", n1, 
   25.32                                                              "Address", addr,
   25.33 -                                                            "EncapsulationMode", "Llc");
   25.34 +                                                            "EncapsulationMode", String ("Llc"));
   25.35    n1->AddDevice (nd1);
   25.36    nd1->SetSendEnable (false);
   25.37    nd1->SetReceiveEnable (true);
   25.38 @@ -88,7 +89,7 @@
   25.39  
   25.40    Ptr<CsmaNetDevice> nd0 = CreateObjectWith<CsmaNetDevice> ("Node", n1, 
   25.41                                                              "Address", addr,
   25.42 -                                                            "EncapsulationMode", "Raw");
   25.43 +                                                            "EncapsulationMode", String ("Raw"));
   25.44    n1->AddDevice (nd0);
   25.45    nd0->SetSendEnable (true);
   25.46    nd0->SetReceiveEnable (false);
   25.47 @@ -97,7 +98,7 @@
   25.48  
   25.49    Ptr<CsmaNetDevice> nd1 = CreateObjectWith<CsmaNetDevice> ("Node", n1, 
   25.50                                                              "Address", addr,
   25.51 -                                                            "EncapsulationMode", "Raw");
   25.52 +                                                            "EncapsulationMode", String ("Raw"));
   25.53    n1->AddDevice (nd1);
   25.54    nd1->SetSendEnable (false);
   25.55    nd1->SetReceiveEnable (true);
    26.1 --- a/src/devices/point-to-point/point-to-point-net-device.cc	Wed Feb 27 20:48:43 2008 +0100
    26.2 +++ b/src/devices/point-to-point/point-to-point-net-device.cc	Wed Feb 27 21:41:34 2008 +0100
    26.3 @@ -23,10 +23,10 @@
    26.4  #include "ns3/log.h"
    26.5  #include "ns3/queue.h"
    26.6  #include "ns3/simulator.h"
    26.7 -#include "ns3/composite-trace-resolver.h"
    26.8  #include "ns3/mac48-address.h"
    26.9  #include "ns3/llc-snap-header.h"
   26.10  #include "ns3/error-model.h"
   26.11 +#include "ns3/trace-source-accessor.h"
   26.12  #include "point-to-point-net-device.h"
   26.13  #include "point-to-point-channel.h"
   26.14  
   26.15 @@ -34,77 +34,59 @@
   26.16  
   26.17  namespace ns3 {
   26.18  
   26.19 -DataRateDefaultValue PointToPointNetDevice::g_defaultRate(
   26.20 -           "PointToPointLinkDataRate", 
   26.21 -           "The default data rate for point to point links",
   26.22 -           MakeDataRate ("10Mb/s"));
   26.23 +NS_OBJECT_ENSURE_REGISTERED (PointToPointNetDevice);
   26.24  
   26.25 -PointToPointTraceType::PointToPointTraceType (enum Type type)
   26.26 -  : m_type (type)
   26.27 +TypeId 
   26.28 +PointToPointNetDevice::GetTypeId (void)
   26.29  {
   26.30 -  NS_LOG_FUNCTION;
   26.31 -}
   26.32 -PointToPointTraceType::PointToPointTraceType ()
   26.33 -  : m_type (RX)
   26.34 -{
   26.35 -  NS_LOG_FUNCTION;
   26.36 +  static TypeId tid = TypeId ("PointToPointNetDevice")
   26.37 +    .SetParent<NetDevice> ()
   26.38 +    .AddConstructor<PointToPointNetDevice> ()
   26.39 +    .AddAttribute ("Node", "The node with which this device is associated",
   26.40 +                   TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT,
   26.41 +                   Ptr<Node> (0),
   26.42 +                   MakePtrAccessor (&PointToPointNetDevice::m_node),
   26.43 +                   MakePtrChecker<Node> ())
   26.44 +    .AddAttribute ("Address", "The address of this device.",
   26.45 +                   Mac48Address ("ff:ff:ff:ff:ff:ff"),
   26.46 +                   MakeMac48AddressAccessor (&PointToPointNetDevice::m_address),
   26.47 +                   MakeMac48AddressChecker ())
   26.48 +    .AddAttribute ("DataRate", "The default data rate for point to point links",
   26.49 +                   DataRate ("10Mb/s"),
   26.50 +                   MakeDataRateAccessor (&PointToPointNetDevice::m_bps),
   26.51 +                   MakeDataRateChecker ())
   26.52 +    .AddAttribute ("RxErrorModel", "XXX",
   26.53 +                   Ptr<ErrorModel> (0),
   26.54 +                   MakePtrAccessor (&PointToPointNetDevice::m_receiveErrorModel),
   26.55 +                   MakePtrChecker<ErrorModel> ())
   26.56 +    .AddAttribute ("TxQueue", "XXX",
   26.57 +                   Ptr<Queue> (0),
   26.58 +                   MakePtrAccessor (&PointToPointNetDevice::m_queue),
   26.59 +                   MakePtrChecker<Queue> ())
   26.60 +    .AddAttribute ("InterframeGap", "XXX",
   26.61 +                   Seconds (0.0),
   26.62 +                   MakeTimeAccessor (&PointToPointNetDevice::m_tInterframeGap),
   26.63 +                   MakeTimeChecker ())
   26.64 +    .AddTraceSource ("Rx", "Receive MAC packet.",
   26.65 +                     MakeTraceSourceAccessor (&PointToPointNetDevice::m_rxTrace))
   26.66 +    .AddTraceSource ("Drop", "Drop MAC packet.",
   26.67 +                     MakeTraceSourceAccessor (&PointToPointNetDevice::m_dropTrace))
   26.68 +
   26.69 +    ;
   26.70 +  return tid;
   26.71  }
   26.72  
   26.73 -void 
   26.74 -PointToPointTraceType::Print (std::ostream &os) const
   26.75 -{
   26.76 -  switch (m_type) {
   26.77 -  case RX:
   26.78 -    os << "dev-rx";
   26.79 -    break;
   26.80 -  case DROP:
   26.81 -    os << "dev-drop";
   26.82 -    break;
   26.83 -  }
   26.84 -}
   26.85  
   26.86 -uint16_t 
   26.87 -PointToPointTraceType::GetUid (void)
   26.88 -{
   26.89 -  NS_LOG_FUNCTION;
   26.90 -  static uint16_t uid = AllocateUid<PointToPointTraceType> ("PointToPointTraceType");
   26.91 -  return uid;
   26.92 -}
   26.93 -
   26.94 -std::string 
   26.95 -PointToPointTraceType::GetTypeName (void) const
   26.96 -{
   26.97 -  NS_LOG_FUNCTION;
   26.98 -  return "ns3::PointToPointTraceType";
   26.99 -}
  26.100 -
  26.101 -enum PointToPointTraceType::Type
  26.102 -PointToPointTraceType::Get (void) const
  26.103 -{
  26.104 -  NS_LOG_FUNCTION;
  26.105 -  return m_type;
  26.106 -}
  26.107 -
  26.108 -PointToPointNetDevice::PointToPointNetDevice (Ptr<Node> node,
  26.109 -                                              Mac48Address address,
  26.110 -                                              const DataRate& rate) 
  26.111 +PointToPointNetDevice::PointToPointNetDevice () 
  26.112  : 
  26.113    m_txMachineState (READY),
  26.114 -  m_bps (rate),
  26.115 -  m_tInterframeGap (Seconds(0)),
  26.116    m_channel (0), 
  26.117 -  m_queue (0),
  26.118 -  m_rxTrace (),
  26.119 -  m_dropTrace (),
  26.120 -  m_receiveErrorModel (0),
  26.121 -  m_node (node),
  26.122 -  m_address (address),
  26.123    m_name (""),
  26.124    m_linkUp (false),
  26.125    m_mtu (0xffff)
  26.126  {
  26.127    NS_LOG_FUNCTION;
  26.128 -  NS_LOG_PARAMS (this << node);
  26.129 +  NS_LOG_PARAMS (this);
  26.130  }
  26.131  
  26.132  PointToPointNetDevice::~PointToPointNetDevice ()
  26.133 @@ -199,26 +181,6 @@
  26.134    TransmitStart(p);
  26.135  }
  26.136  
  26.137 -Ptr<TraceResolver> 
  26.138 -PointToPointNetDevice::GetTraceResolver (void) const
  26.139 -{
  26.140 -  NS_LOG_FUNCTION;
  26.141 -  Ptr<CompositeTraceResolver> resolver = Create<CompositeTraceResolver> ();
  26.142 -  resolver->AddComposite ("queue", m_queue);
  26.143 -  resolver->AddSource ("rx",
  26.144 -                       TraceDoc ("receive MAC packet",
  26.145 -                                 "Ptr<const Packet>", "packet received"),
  26.146 -                       m_rxTrace,
  26.147 -                       PointToPointTraceType (PointToPointTraceType::RX));
  26.148 -  resolver->AddSource ("drop",
  26.149 -                       TraceDoc ("drop MAC packet",
  26.150 -                                 "Ptr<const Packet>", "packet dropped"),
  26.151 -                       m_dropTrace,
  26.152 -                       PointToPointTraceType (PointToPointTraceType::DROP));
  26.153 -  resolver->SetParentResolver (NetDevice::GetTraceResolver ());
  26.154 -  return resolver;
  26.155 -}
  26.156 -
  26.157  bool 
  26.158  PointToPointNetDevice::Attach (Ptr<PointToPointChannel> ch)
  26.159  {
    27.1 --- a/src/devices/point-to-point/point-to-point-net-device.h	Wed Feb 27 20:48:43 2008 +0100
    27.2 +++ b/src/devices/point-to-point/point-to-point-net-device.h	Wed Feb 27 21:41:34 2008 +0100
    27.3 @@ -27,10 +27,9 @@
    27.4  #include "ns3/net-device.h"
    27.5  #include "ns3/callback.h"
    27.6  #include "ns3/packet.h"
    27.7 -#include "ns3/callback-trace-source.h"
    27.8 +#include "ns3/traced-callback.h"
    27.9  #include "ns3/nstime.h"
   27.10  #include "ns3/data-rate.h"
   27.11 -#include "ns3/default-value.h"
   27.12  #include "ns3/ptr.h"
   27.13  #include "ns3/mac48-address.h"
   27.14  
   27.15 @@ -41,29 +40,6 @@
   27.16  class ErrorModel;
   27.17  
   27.18  /**
   27.19 - * \brief hold in a TraceContext the type of trace source from a PointToPointNetDevice
   27.20 - */
   27.21 -class PointToPointTraceType : public TraceContextElement
   27.22 -{
   27.23 -public:
   27.24 -  enum Type {
   27.25 -    RX,
   27.26 -    DROP
   27.27 -  };
   27.28 -  PointToPointTraceType (enum Type type);
   27.29 -  PointToPointTraceType ();
   27.30 -  void Print (std::ostream &os) const;
   27.31 -  static uint16_t GetUid (void);
   27.32 -  std::string GetTypeName (void) const;
   27.33 -  /**
   27.34 -   * \returns the type of the trace source which generated an event.
   27.35 -   */
   27.36 -  enum Type Get (void) const;
   27.37 -private:
   27.38 -  enum Type m_type;
   27.39 -};
   27.40 -
   27.41 -/**
   27.42   * \class PointToPointNetDevice
   27.43   * \brief A Device for a Point to Point Network Link.
   27.44   *
   27.45 @@ -78,6 +54,8 @@
   27.46  class PointToPointNetDevice : public NetDevice 
   27.47  {
   27.48  public:
   27.49 +  static TypeId GetTypeId (void);
   27.50 +
   27.51    /**
   27.52     * Construct a PointToPointNetDevice
   27.53     *
   27.54 @@ -86,12 +64,8 @@
   27.55     * as well as an optional DataRate object.
   27.56     *
   27.57     * @see PointToPointTopology::AddPointToPointLink ()
   27.58 -   * @param node the Node to which this device is connected.
   27.59 -   * @param rate (optional) DataRate object
   27.60     */
   27.61 -  PointToPointNetDevice (Ptr<Node> node,
   27.62 -                         Mac48Address address,
   27.63 -                         const DataRate& rate = g_defaultRate.GetValue());
   27.64 +  PointToPointNetDevice ();
   27.65    /**
   27.66     * Destroy a PointToPointNetDevice
   27.67     *
   27.68 @@ -194,12 +168,6 @@
   27.69    virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
   27.70  
   27.71  private:
   27.72 -  /**
   27.73 -   * Create a Trace Resolver for events in the net device.
   27.74 -   *
   27.75 -   * @see class TraceResolver
   27.76 -   */
   27.77 -  virtual Ptr<TraceResolver> GetTraceResolver (void) const;
   27.78  
   27.79    virtual void DoDispose (void);
   27.80    /**
   27.81 @@ -213,18 +181,6 @@
   27.82     */
   27.83    Ptr<Queue> GetQueue(void) const; 
   27.84  
   27.85 -
   27.86 -  /**
   27.87 -   * Set a new default data rate
   27.88 -   */
   27.89 -  static void SetDefaultRate(const DataRate&);
   27.90 -
   27.91 -  /** 
   27.92 -   * Get the current default rate.
   27.93 -   * @returns a const reference to current default
   27.94 -   */
   27.95 -  static const DataRate& GetDefaultRate();
   27.96 -
   27.97  private:
   27.98    /**
   27.99     * Adds the necessary headers and trailers to a packet of data in order to
  27.100 @@ -310,7 +266,7 @@
  27.101     * @see class CallBackTraceSource
  27.102     * @see class TraceResolver
  27.103     */
  27.104 -  CallbackTraceSource<Ptr<const Packet> > m_rxTrace;
  27.105 +  TracedCallback<Ptr<const Packet> > m_rxTrace;
  27.106    /**
  27.107     * The trace source for the packet drop events that the device can
  27.108     * fire.
  27.109 @@ -318,11 +274,7 @@
  27.110     * @see class CallBackTraceSource
  27.111     * @see class TraceResolver
  27.112     */
  27.113 -  CallbackTraceSource<Ptr<const Packet> > m_dropTrace;
  27.114 -  /** 
  27.115 -   * Default data rate.  Used for all newly created p2p net devices
  27.116 -   */
  27.117 -   static DataRateDefaultValue g_defaultRate;
  27.118 +  TracedCallback<Ptr<const Packet> > m_dropTrace;
  27.119  
  27.120    /**
  27.121     * Error model for receive packet events
  27.122 @@ -339,7 +291,7 @@
  27.123    uint16_t m_mtu;
  27.124  };
  27.125  
  27.126 -}; // namespace ns3
  27.127 +} // namespace ns3
  27.128  
  27.129  #endif // POINT_TO_POINT_NET_DEVICE_H
  27.130  
    28.1 --- a/src/devices/point-to-point/point-to-point-topology.cc	Wed Feb 27 20:48:43 2008 +0100
    28.2 +++ b/src/devices/point-to-point/point-to-point-topology.cc	Wed Feb 27 21:41:34 2008 +0100
    28.3 @@ -47,14 +47,16 @@
    28.4  {
    28.5    Ptr<PointToPointChannel> channel = CreateObject<PointToPointChannel> (bps, delay);
    28.6  
    28.7 -  Ptr<PointToPointNetDevice> net1 = CreateObject<PointToPointNetDevice> (n1, Mac48Address::Allocate ());
    28.8 +  Ptr<PointToPointNetDevice> net1 = CreateObjectWith<PointToPointNetDevice> ("Node", n1, 
    28.9 +                                                                             "Address", Mac48Address::Allocate ());
   28.10    n1->AddDevice (net1);
   28.11  
   28.12    Ptr<Queue> q = Queue::CreateDefault ();
   28.13    net1->AddQueue(q);
   28.14    net1->Attach (channel);
   28.15    
   28.16 -  Ptr<PointToPointNetDevice> net2 = CreateObject<PointToPointNetDevice> (n2, Mac48Address::Allocate ());
   28.17 +  Ptr<PointToPointNetDevice> net2 = CreateObjectWith<PointToPointNetDevice> ("Node", n2, 
   28.18 +                                                                             "Address", Mac48Address::Allocate ());
   28.19    n2->AddDevice (net2);
   28.20  
   28.21    q = Queue::CreateDefault ();
    29.1 --- a/src/node/ipv4-address.cc	Wed Feb 27 20:48:43 2008 +0100
    29.2 +++ b/src/node/ipv4-address.cc	Wed Feb 27 21:41:34 2008 +0100
    29.3 @@ -305,14 +305,14 @@
    29.4  {
    29.5    std::string str;
    29.6    is >> str;
    29.7 -  address = Ipv4Address (str);
    29.8 +  address = Ipv4Address (str.c_str ());
    29.9    return is;
   29.10  }
   29.11  std::istream & operator >> (std::istream &is, Ipv4Mask &mask)
   29.12  {
   29.13    std::string str;
   29.14    is >> str;
   29.15 -  mask = Ipv4Mask (str);
   29.16 +  mask = Ipv4Mask (str.c_str ());
   29.17    return is;
   29.18  }
   29.19  
    30.1 --- a/tutorial/point-to-point-ipv4-topology.cc	Wed Feb 27 20:48:43 2008 +0100
    30.2 +++ b/tutorial/point-to-point-ipv4-topology.cc	Wed Feb 27 21:41:34 2008 +0100
    30.3 @@ -43,7 +43,9 @@
    30.4  {
    30.5    NS_ASSERT (channel->GetNDevices () <= 1);
    30.6  
    30.7 -  Ptr<PointToPointNetDevice> nd = CreateObject<PointToPointNetDevice> (node, Mac48Address::Allocate ());
    30.8 +  Ptr<PointToPointNetDevice> nd = 
    30.9 +    CreateObjectWith<PointToPointNetDevice> ("Node", node, 
   30.10 +                                             "Address", Mac48Address::Allocate ());
   30.11    node->AddDevice (nd);
   30.12    Ptr<Queue> q = Queue::CreateDefault ();
   30.13    nd->AddQueue(q);
    31.1 --- a/utils/print-introspected-doxygen.cc	Wed Feb 27 20:48:43 2008 +0100
    31.2 +++ b/utils/print-introspected-doxygen.cc	Wed Feb 27 21:41:34 2008 +0100
    31.3 @@ -7,6 +7,7 @@
    31.4  #include "ns3/queue.h"
    31.5  #include "ns3/mobility-model-notifier.h"
    31.6  #include "ns3/default-value.h"
    31.7 +#include "ns3/string.h"
    31.8  
    31.9  using namespace ns3;
   31.10  
   31.11 @@ -119,12 +120,13 @@
   31.12    Ptr<Node> node = CreateObject<InternetNode> ();
   31.13    node->AggregateObject (CreateObject<MobilityModelNotifier> ());
   31.14  
   31.15 -  Ptr<PointToPointNetDevice> p2p = CreateObject<PointToPointNetDevice> (node, Mac48Address::Allocate ());
   31.16 +  Ptr<PointToPointNetDevice> p2p = CreateObjectWith<PointToPointNetDevice> ("Node", node, 
   31.17 +									    "Address", Mac48Address::Allocate ());
   31.18    node->AddDevice (p2p);
   31.19    p2p->AddQueue (Queue::CreateDefault ());
   31.20    Ptr<CsmaNetDevice> csma = CreateObjectWith<CsmaNetDevice> ("Node", node, 
   31.21  							     "Address", Mac48Address::Allocate (),
   31.22 -							     "EncapsulationMode", "Llc");
   31.23 +							     "EncapsulationMode", String ("Llc"));
   31.24    node->AddDevice (csma);
   31.25    csma->AddQueue (Queue::CreateDefault ());
   31.26