add examples of Config::Set to example names.cc
authorCraig Dowell <craigdo@ee.washington.edu>
Tue Jan 20 21:55:04 2009 -0800 (12 months ago)
changeset 4144c59fdf82869b
parent 4143 7f7823a31f77
child 4145 bb930262e55c
add examples of Config::Set to example names.cc
examples/names.cc
     1.1 --- a/examples/names.cc	Tue Jan 20 21:16:52 2009 -0800
     1.2 +++ b/examples/names.cc	Tue Jan 20 21:55:04 2009 -0800
     1.3 @@ -79,6 +79,23 @@
     1.4    Names::Add ("/Names/client/eth0", d.Get (0));
     1.5    Names::Add ("/Names/server/eth0", d.Get (1));
     1.6  
     1.7 +  //
     1.8 +  // You can use the object names that you've assigned in calls to the Config
     1.9 +  // system to set Object Attributes.  For example, you can set the Mtu 
    1.10 +  // Attribute of a Csma devices using the object naming service.
    1.11 +  //
    1.12 +  Config::Set ("/Names/client/eth0/Mtu", UintegerValue (1234));
    1.13 +
    1.14 +  //
    1.15 +  // You can mix and match names and Attributes in calls to the Config system.
    1.16 +  // For example, if "eth0" is a named object, you can get to its parent through
    1.17 +  // a different namespace.  For example, you could use the NodeList namespace
    1.18 +  // to get to the server node, and then continue seamlessly adding named objects
    1.19 +  // in the path. This is not nearly as readable as the previous version, but it
    1.20 +  // illustrates how you can mix and match object names and Attribute names.
    1.21 +  //
    1.22 +  Config::Set ("/NodeList/1/eth0/Mtu", UintegerValue (1234));
    1.23 +
    1.24    Ipv4AddressHelper ipv4;
    1.25    ipv4.SetBase ("10.1.1.0", "255.255.255.0");
    1.26    Ipv4InterfaceContainer i = ipv4.Assign (d);
    1.27 @@ -109,8 +126,8 @@
    1.28    apps.Stop (Seconds (10.0));
    1.29  
    1.30    //
    1.31 -  // Use the config system to connect a trace source using the object name
    1.32 -  // system to specify the path.
    1.33 +  // Use the Config system to connect a trace source using the object name
    1.34 +  // service to specify the path.
    1.35    //
    1.36    Config::Connect ("/Names/client/eth0/Rx", MakeCallback (&RxEvent));
    1.37