fix instances of stale names
authorCraig Dowell <craigdo@ee.washington.edu>
Mon Feb 04 19:17:45 2008 -0800 (2008-02-04)
changeset 2313876fbd1fd5dd
parent 2312 f30bf492f4f1
child 2314 de866c8f30e7
child 2319 473f25177907
fix instances of stale names
doc/tutorial/introduction.texi
doc/tutorial/other.texi
doc/tutorial/routing.texi
doc/tutorial/troubleshoot.texi
     1.1 --- a/doc/tutorial/introduction.texi	Mon Feb 04 19:04:01 2008 -0800
     1.2 +++ b/doc/tutorial/introduction.texi	Mon Feb 04 19:17:45 2008 -0800
     1.3 @@ -650,14 +650,14 @@
     1.4  examine this in some detail here.
     1.5  
     1.6  @cindex InternetNode
     1.7 -@cindex Create
     1.8 +@cindex CreateObject
     1.9  @cindex Ptr
    1.10  In @command{ns-3}, if we want to create an @code{InternetNode} in a 
    1.11  script, we will 
    1.12  typically do something like the following example:
    1.13  
    1.14  @verbatim
    1.15 -  Ptr<Node> p = Create<InternetNode> ();
    1.16 +  Ptr<Node> p = CreateObject<InternetNode> ();
    1.17  @end verbatim
    1.18  
    1.19  @cindex smart pointer
    1.20 @@ -677,7 +677,7 @@
    1.21  using C++ @emph{templates}.  
    1.22  
    1.23  @verbatim
    1.24 -  Ptr<Node> p = Create<InternetNode> ();
    1.25 +  Ptr<Node> p = CreateObject<InternetNode> ();
    1.26  @end verbatim
    1.27  
    1.28  The purpose of templates is to allow a programmer to write one version of code
    1.29 @@ -955,21 +955,21 @@
    1.30  @end verbatim
    1.31  
    1.32  @subsection Object Creation
    1.33 -@cindex Create
    1.34 +@cindex CreateObject
    1.35  On the right hand side of the line of code we're examining (reproduced below
    1.36  for convenience) is the creation of an @code{InternetNode} object.
    1.37  
    1.38  @verbatim
    1.39 -  ... = Create<InternetNode> ();
    1.40 +  ... = CreateObject<InternetNode> ();
    1.41  @end verbatim
    1.42  
    1.43  @cindex template!function
    1.44  This turns out to be an instance of use of a C++ @emph{function template}. The
    1.45 -definition of the @code{Create<typename T>()} template calls the new operator
    1.46 -to create an object of the type T.  It then creates a new smart pointer of
    1.47 -the appropriate type (i.e., @code{Ptr<T>}).  This new smart pointer is
    1.48 -assigned initial responsibility for the new object which has its reference
    1.49 -count set to one.
    1.50 +definition of the @code{CreateObject<typename T>()} template calls the new 
    1.51 +operator to create an object of the type T.  It then creates a new smart 
    1.52 +pointer of the appropriate type (i.e., @code{Ptr<T>}).  This new smart 
    1.53 +pointer is assigned initial responsibility for the new object which has its 
    1.54 +reference count set to one.
    1.55  
    1.56  Since the underlying creation mechanism is via the @code{new} operator, and
    1.57  you can pass parameters to the constructor for an object, we provide several
    1.58 @@ -979,7 +979,7 @@
    1.59  
    1.60  @verbatim
    1.61    int parm = 1;
    1.62 -  ... = Create<MyClass> (parm);
    1.63 +  ... = CreateObject<MyClass> (parm);
    1.64  @end verbatim
    1.65  
    1.66  We provide Create templates with up to seven parameters, so you could 
    1.67 @@ -987,7 +987,7 @@
    1.68  
    1.69  @verbatim
    1.70    int parm = 1;
    1.71 -  ... = Create<MyClass> (p1, p2, p3, p4, p5, p6, p7);
    1.72 +  ... = CreateObject<MyClass> (p1, p2, p3, p4, p5, p6, p7);
    1.73  @end verbatim
    1.74  
    1.75  @subsection Type Safety
    1.76 @@ -995,7 +995,7 @@
    1.77  have been examining for some time (again reproduced below).
    1.78  
    1.79  @verbatim
    1.80 -  Ptr<Node> p = Create<InternetNode> ();
    1.81 +  Ptr<Node> p = CreateObject<InternetNode> ();
    1.82  @end verbatim
    1.83  
    1.84  @cindex smart pointer
    1.85 @@ -1057,19 +1057,19 @@
    1.86  to a base class happening in the assignment.  That means that
    1.87  
    1.88  @verbatim
    1.89 -  Ptr<Node> p = Create<InternetNode> ();
    1.90 +  Ptr<Node> p = CreateObject<InternetNode> ();
    1.91  @end verbatim
    1.92  
    1.93  or,
    1.94  
    1.95  @verbatim
    1.96 -  Ptr<Channel> p = Create<CsmaChannel> ();
    1.97 +  Ptr<Channel> p = CreateObject<CsmaChannel> ();
    1.98  @end verbatim
    1.99  
   1.100  will work just fine.  Of course, if you try something @emph{bad} (TM), like:
   1.101  
   1.102  @verbatim
   1.103 -  Ptr<Node> p = Create<CsmaChannel> ();
   1.104 +  Ptr<Node> p = CreateObject<CsmaChannel> ();
   1.105  @end verbatim
   1.106  
   1.107  the compiler will quite appropriately complain that there is no conversion
   1.108 @@ -1081,7 +1081,7 @@
   1.109  like:
   1.110  
   1.111  @verbatim
   1.112 -  Ptr<Node> p = Create<InternetNode> ();
   1.113 +  Ptr<Node> p = CreateObject<InternetNode> ();
   1.114  @end verbatim
   1.115  
   1.116  @cindex Create
   1.117 @@ -1174,10 +1174,10 @@
   1.118  after the call to @code{NS_LOG_INFO}.
   1.119  
   1.120  @verbatim
   1.121 -  Ptr<Node> n0 = Create<InternetNode> ();
   1.122 -  Ptr<Node> n1 = Create<InternetNode> ();
   1.123 -  Ptr<Node> n2 = Create<InternetNode> ();
   1.124 -  Ptr<Node> n3 = Create<InternetNode> ();
   1.125 +  Ptr<Node> n0 = CreateObject<InternetNode> ();
   1.126 +  Ptr<Node> n1 = CreateObject<InternetNode> ();
   1.127 +  Ptr<Node> n2 = CreateObject<InternetNode> ();
   1.128 +  Ptr<Node> n3 = CreateObject<InternetNode> ();
   1.129  @end verbatim
   1.130  
   1.131  As we now understand, this will create four @code{InternetNode} objects on
   1.132 @@ -1359,10 +1359,10 @@
   1.133  
   1.134      NS_LOG_INFO ("Hello Simulator");
   1.135  
   1.136 -    Ptr<Node> n0 = Create<InternetNode> ();
   1.137 -    Ptr<Node> n1 = Create<InternetNode> ();
   1.138 -    Ptr<Node> n2 = Create<InternetNode> ();
   1.139 -    Ptr<Node> n3 = Create<InternetNode> ();
   1.140 +    Ptr<Node> n0 = CreateObject<InternetNode> ();
   1.141 +    Ptr<Node> n1 = CreateObject<InternetNode> ();
   1.142 +    Ptr<Node> n2 = CreateObject<InternetNode> ();
   1.143 +    Ptr<Node> n3 = CreateObject<InternetNode> ();
   1.144  
   1.145      Ptr<CsmaChannel> lan = 
   1.146        CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
   1.147 @@ -1423,8 +1423,8 @@
   1.148    uint32_t maxPacketCount = 1;
   1.149    Time interPacketInterval = Seconds (1.);
   1.150  
   1.151 -  Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port, 
   1.152 -    maxPacketCount, interPacketInterval, packetSize);
   1.153 +  Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.1.2", 
   1.154 +    port, maxPacketCount, interPacketInterval, packetSize);
   1.155  @end verbatim
   1.156  
   1.157  @cindex packet
   1.158 @@ -1466,7 +1466,7 @@
   1.159    Ipv4Address addr ("10.1.1.2");
   1.160    ...
   1.161  
   1.162 -  Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, addr, port, 
   1.163 +  Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, addr, port, 
   1.164      maxPacketCount, interPacketInterval, packetSize);
   1.165  @end verbatim
   1.166  
   1.167 @@ -1474,7 +1474,7 @@
   1.168  You can use the unnamed parameter idiom that we have previously seen:
   1.169  
   1.170  @verbatim
   1.171 -  Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, 
   1.172 +  Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, 
   1.173      Ipv4Address ("10.1.1.2"), port, maxPacketCount, interPacketInterval, 
   1.174      packetSize);
   1.175  @end verbatim
   1.176 @@ -1482,8 +1482,8 @@
   1.177  Or you can rely on implicit conversion sequences as we just saw:
   1.178  
   1.179  @verbatim
   1.180 -  Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port, 
   1.181 -    maxPacketCount, interPacketInterval, packetSize);
   1.182 +  Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.1.2", 
   1.183 +    port, maxPacketCount, interPacketInterval, packetSize);
   1.184  @end verbatim
   1.185  
   1.186  Which approach to take is a matter of style, really, and you will probably
   1.187 @@ -1502,7 +1502,7 @@
   1.188  following code:
   1.189  
   1.190  @verbatim
   1.191 -  Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
   1.192 +  Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
   1.193  @end verbatim
   1.194  
   1.195  We only need to tell the application which node to reside on and which port
   1.196 @@ -1538,10 +1538,10 @@
   1.197  
   1.198      NS_LOG_INFO ("UDP Echo Simulation");
   1.199  
   1.200 -    Ptr<Node> n0 = Create<InternetNode> ();
   1.201 -    Ptr<Node> n1 = Create<InternetNode> ();
   1.202 -    Ptr<Node> n2 = Create<InternetNode> ();
   1.203 -    Ptr<Node> n3 = Create<InternetNode> ();
   1.204 +    Ptr<Node> n0 = CreateObject<InternetNode> ();
   1.205 +    Ptr<Node> n1 = CreateObject<InternetNode> ();
   1.206 +    Ptr<Node> n2 = CreateObject<InternetNode> ();
   1.207 +    Ptr<Node> n3 = CreateObject<InternetNode> ();
   1.208  
   1.209      Ptr<CsmaChannel> lan = 
   1.210        CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
   1.211 @@ -1575,10 +1575,10 @@
   1.212      uint32_t maxPacketCount = 1;
   1.213      Time interPacketInterval = Seconds (1.);
   1.214  
   1.215 -    Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port, 
   1.216 -      maxPacketCount, interPacketInterval, packetSize);
   1.217 +    Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.1.2", 
   1.218 +      port, maxPacketCount, interPacketInterval, packetSize);
   1.219  
   1.220 -    Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
   1.221 +    Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
   1.222  
   1.223    }
   1.224  @end verbatim
   1.225 @@ -1792,10 +1792,10 @@
   1.226  
   1.227      NS_LOG_INFO ("UDP Echo Simulation");
   1.228  
   1.229 -    Ptr<Node> n0 = Create<InternetNode> ();
   1.230 -    Ptr<Node> n1 = Create<InternetNode> ();
   1.231 -    Ptr<Node> n2 = Create<InternetNode> ();
   1.232 -    Ptr<Node> n3 = Create<InternetNode> ();
   1.233 +    Ptr<Node> n0 = CreateObject<InternetNode> ();
   1.234 +    Ptr<Node> n1 = CreateObject<InternetNode> ();
   1.235 +    Ptr<Node> n2 = CreateObject<InternetNode> ();
   1.236 +    Ptr<Node> n3 = CreateObject<InternetNode> ();
   1.237  
   1.238      Ptr<CsmaChannel> lan = 
   1.239        CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
   1.240 @@ -1829,10 +1829,10 @@
   1.241      uint32_t maxPacketCount = 1;
   1.242      Time interPacketInterval = Seconds (1.);
   1.243  
   1.244 -    Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port, 
   1.245 -      maxPacketCount, interPacketInterval, packetSize);
   1.246 +    Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n0, "10.1.1.2", 
   1.247 +      port, maxPacketCount, interPacketInterval, packetSize);
   1.248  
   1.249 -    Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
   1.250 +    Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
   1.251  
   1.252      server->Start(Seconds(1.));
   1.253      client->Start(Seconds(2.));
     2.1 --- a/doc/tutorial/other.texi	Mon Feb 04 19:04:01 2008 -0800
     2.2 +++ b/doc/tutorial/other.texi	Mon Feb 04 19:17:45 2008 -0800
     2.3 @@ -1882,7 +1882,7 @@
     2.4  @verbatim
     2.5    Ptr<Ipv4Impl> ipv4Impl = CreateObject<Ipv4Impl> (ipv4);
     2.6    ...
     2.7 -  Object::AddInterface (ipv4Impl);
     2.8 +  Object::AggregateObject (ipv4Impl);
     2.9  @end verbatim
    2.10  
    2.11  Note that the parameter @code{ipv4} passed to the @code{CreateObject} template
     3.1 --- a/doc/tutorial/routing.texi	Mon Feb 04 19:04:01 2008 -0800
     3.2 +++ b/doc/tutorial/routing.texi	Mon Feb 04 19:17:45 2008 -0800
     3.3 @@ -341,8 +341,8 @@
     3.4    for (Iterator i = NodeList::Begin (); i != NodeList::End (); i++)
     3.5      {
     3.6        Ptr<Node> node = *i;
     3.7 -      Ptr<GlobalRouter> globalRouter = Create<GlobalRouter> (node);
     3.8 -      node->AddInterface (globalRouter);
     3.9 +      Ptr<GlobalRouter> globalRouter = CreateObject<GlobalRouter> (node);
    3.10 +      node->AggregateObject (globalRouter);
    3.11      }
    3.12  @end verbatim
    3.13  
     4.1 --- a/doc/tutorial/troubleshoot.texi	Mon Feb 04 19:04:01 2008 -0800
     4.2 +++ b/doc/tutorial/troubleshoot.texi	Mon Feb 04 19:17:45 2008 -0800
     4.3 @@ -66,12 +66,12 @@
     4.4  
     4.5  Let's look around line 136 of tcp-point-to-point, as gdb suggests:
     4.6  @verbatim
     4.7 -  Ptr<SocketFactory> socketFactory = n2->QueryInterface<SocketFactory> (Tcp::iid);
     4.8 +  Ptr<SocketFactory> socketFactory = n2->GetObject<SocketFactory> (Tcp::iid);
     4.9    Ptr<Socket> localSocket = socketFactory->CreateSocket ();
    4.10    localSocket->Bind ();
    4.11  @end verbatim
    4.12  
    4.13 -The culprit here is that the return value of QueryInterface is not being
    4.14 +The culprit here is that the return value of GetObject is not being
    4.15  checked and may be null.  
    4.16  
    4.17  Sometimes you may need to use the @uref{http://valgrind.org,,valgrind memory