Don't recompute NodeList::End () at every loop in GlobalRouteManagerImpl
authorGuillaume Seguin <guillaume.seguin@sophia.inria.fr>
Sat Sep 05 16:31:07 2009 -0700 (5 months ago)
changeset 47580f9bcd407aff
parent 4757 1b7c28a1c131
child 4759 a18ac083ec51
Don't recompute NodeList::End () at every loop in GlobalRouteManagerImpl
src/routing/global-routing/global-route-manager-impl.cc
     1.1 --- a/src/routing/global-routing/global-route-manager-impl.cc	Fri Sep 04 18:02:03 2009 -0700
     1.2 +++ b/src/routing/global-routing/global-route-manager-impl.cc	Sat Sep 05 16:31:07 2009 -0700
     1.3 @@ -406,7 +406,8 @@
     1.4  GlobalRouteManagerImpl::DeleteGlobalRoutes ()
     1.5  {
     1.6    NS_LOG_FUNCTION_NOARGS ();
     1.7 -  for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++)
     1.8 +  NodeList::Iterator listEnd = NodeList::End ();
     1.9 +  for (NodeList::Iterator i = NodeList::Begin (); i != listEnd; i++)
    1.10      {
    1.11        Ptr<Node> node = *i;
    1.12        Ptr<GlobalRouter> router = node->GetObject<GlobalRouter> ();
    1.13 @@ -453,7 +454,8 @@
    1.14  // Walk the list of nodes looking for the GlobalRouter Interface.  Nodes with
    1.15  // global router interfaces are, not too surprisingly, our routers.
    1.16  //
    1.17 -  for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++)
    1.18 +  NodeList::Iterator listEnd = NodeList::End ();
    1.19 +  for (NodeList::Iterator i = NodeList::Begin (); i != listEnd; i++)
    1.20      {
    1.21        Ptr<Node> node = *i;
    1.22  
    1.23 @@ -534,7 +536,8 @@
    1.24  //
    1.25  // Walk the list of nodes in the system.
    1.26  //
    1.27 -  for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++)
    1.28 +  NodeList::Iterator listEnd = NodeList::End ();
    1.29 +  for (NodeList::Iterator i = NodeList::Begin (); i != listEnd; i++)
    1.30      {
    1.31        Ptr<Node> node = *i;
    1.32  //
    1.33 @@ -1351,7 +1354,8 @@
    1.34  // the routing information to.
    1.35  //
    1.36    NodeList::Iterator i = NodeList::Begin (); 
    1.37 -  for (; i != NodeList::End (); i++)
    1.38 +  NodeList::Iterator listEnd = NodeList::End ();
    1.39 +  for (; i != listEnd; i++)
    1.40      {
    1.41        Ptr<Node> node = *i;
    1.42  //
    1.43 @@ -1516,7 +1520,8 @@
    1.44  // the routing information to.
    1.45  //
    1.46    NodeList::Iterator i = NodeList::Begin (); 
    1.47 -  for (; i != NodeList::End (); i++)
    1.48 +  NodeList::Iterator listEnd = NodeList::End ();
    1.49 +  for (; i != listEnd; i++)
    1.50      {
    1.51        Ptr<Node> node = *i;
    1.52  //
    1.53 @@ -1637,7 +1642,8 @@
    1.54  // building the routing table.
    1.55  //
    1.56    NodeList::Iterator i = NodeList::Begin (); 
    1.57 -  for (; i != NodeList::End (); i++)
    1.58 +  NodeList::Iterator listEnd = NodeList::End ();
    1.59 +  for (; i != listEnd; i++)
    1.60      {
    1.61        Ptr<Node> node = *i;
    1.62  
    1.63 @@ -1727,7 +1733,8 @@
    1.64  // the routing information to.
    1.65  //
    1.66    NodeList::Iterator i = NodeList::Begin (); 
    1.67 -  for (; i != NodeList::End (); i++)
    1.68 +  NodeList::Iterator listEnd = NodeList::End ();
    1.69 +  for (; i != listEnd; i++)
    1.70      {
    1.71        Ptr<Node> node = *i;
    1.72  //
    1.73 @@ -1867,7 +1874,8 @@
    1.74  // the routing information to.
    1.75  //
    1.76    NodeList::Iterator i = NodeList::Begin (); 
    1.77 -  for (; i != NodeList::End (); i++)
    1.78 +  NodeList::Iterator listEnd = NodeList::End ();
    1.79 +  for (; i != listEnd; i++)
    1.80      {
    1.81        Ptr<Node> node = *i;
    1.82  //