Point-to-point-layout code-style changes
authorJohn Abraham<john.abraham@gatech.edu>
Wed, 04 May 2011 15:11:13 -0700
changeset 7132 c7c8d07fb48a
parent 7131 77b75cd826d0
child 7133 db7061624ae6
Point-to-point-layout code-style changes
src/point-to-point-layout/model/point-to-point-dumbbell.cc
src/point-to-point-layout/model/point-to-point-dumbbell.h
src/point-to-point-layout/model/point-to-point-grid.cc
src/point-to-point-layout/model/point-to-point-grid.h
src/point-to-point-layout/model/point-to-point-star.cc
src/point-to-point-layout/model/point-to-point-star.h
--- a/src/point-to-point-layout/model/point-to-point-dumbbell.cc	Wed May 04 11:20:20 2011 -0700
+++ b/src/point-to-point-layout/model/point-to-point-dumbbell.cc	Wed May 04 15:11:13 2011 -0700
@@ -33,12 +33,12 @@
 NS_LOG_COMPONENT_DEFINE("PointToPointDumbbellHelper");
 
 namespace ns3 {
-  
+
 PointToPointDumbbellHelper::PointToPointDumbbellHelper (uint32_t nLeftLeaf,
-                   PointToPointHelper leftHelper,
-                   uint32_t nRightLeaf,
-                   PointToPointHelper rightHelper,
-                   PointToPointHelper bottleneckHelper)
+                                                        PointToPointHelper leftHelper,
+                                                        uint32_t nRightLeaf,
+                                                        PointToPointHelper rightHelper,
+                                                        PointToPointHelper bottleneckHelper)
 {
   // Create the bottleneck routers
   m_routers.Create (2);
@@ -52,7 +52,7 @@
   for (uint32_t i = 0; i < nLeftLeaf; ++i)
     {
       NetDeviceContainer c = leftHelper.Install (m_routers.Get (0),
-                                                m_leftLeaf.Get (i));
+                                                 m_leftLeaf.Get (i));
       m_leftRouterDevices.Add (c.Get (0));
       m_leftLeafDevices.Add (c.Get(1));
     }
@@ -60,7 +60,7 @@
   for (uint32_t i = 0; i < nRightLeaf; ++i)
     {
       NetDeviceContainer c = rightHelper.Install (m_routers.Get (1),
-                                                m_rightLeaf.Get (i));
+                                                  m_rightLeaf.Get (i));
       m_rightRouterDevices.Add (c.Get (0));
       m_rightLeafDevices.Add (c.Get (1));
     }
@@ -117,8 +117,8 @@
 }
 
 void PointToPointDumbbellHelper::AssignIpv4Addresses (Ipv4AddressHelper leftIp,
-                               Ipv4AddressHelper rightIp,
-                               Ipv4AddressHelper routerIp)
+                                                      Ipv4AddressHelper rightIp,
+                                                      Ipv4AddressHelper routerIp)
 {
   // Assign the router network
   m_routerInterfaces = routerIp.Assign (m_routerDevices);
@@ -148,7 +148,7 @@
 
 
 void PointToPointDumbbellHelper::BoundingBox (double ulx, double uly, // Upper left x/y
-                           double lrx, double lry) // Lower right y
+                                              double lrx, double lry) // Lower right y
 {
   double xDist;
   double yDist;
@@ -183,7 +183,7 @@
     }
   Vector lrl (ulx + xAdder, uly + yDist/2.0, 0);
   loc->SetPosition (lrl);
-  
+
   // Place the right router
   Ptr<Node> rr = GetRight ();
   loc = rr->GetObject<ConstantPositionMobilityModel> ();
@@ -216,7 +216,7 @@
           ln->AggregateObject (loc);
         }
       Vector lnl (lrl.x - cos (theta) * xAdder,
-                   lrl.y + sin (theta) * xAdder, 0);  // Left Node Location
+                  lrl.y + sin (theta) * xAdder, 0);   // Left Node Location
       // Insure did not exceed bounding box
       if (lnl.y < uly) 
         {
@@ -249,7 +249,7 @@
           rn->AggregateObject (loc);
         }
       Vector rnl (rrl.x + cos (theta) * xAdder, // Right node location
-                   rrl.y + sin (theta) * xAdder, 0);
+                  rrl.y + sin (theta) * xAdder, 0);
       // Insure did not exceed bounding box
       if (rnl.y < uly) 
         {
@@ -263,5 +263,5 @@
       theta += thetaR;
     }
 }
-  
+
 } // namespace ns3
--- a/src/point-to-point-layout/model/point-to-point-dumbbell.h	Wed May 04 11:20:20 2011 -0700
+++ b/src/point-to-point-layout/model/point-to-point-dumbbell.h	Wed May 04 15:11:13 2011 -0700
@@ -29,7 +29,7 @@
 #include "ipv4-interface-container.h"
 
 namespace ns3 {
-  
+
 /**
  * \brief A helper to make it easier to create a dumbbell topology
  * with p2p links
@@ -71,7 +71,7 @@
    *          router
    */
   Ptr<Node> GetLeft () const;
-  
+
   /**
    * \returns pointer to the i'th left side leaf node
    */
@@ -138,7 +138,7 @@
    * \param lry lower right y value
    */
   void      BoundingBox (double ulx, double uly, double lrx, double lry);
-  
+
 private:
   NodeContainer          m_leftLeaf;
   NetDeviceContainer     m_leftLeafDevices;
--- a/src/point-to-point-layout/model/point-to-point-grid.cc	Wed May 04 11:20:20 2011 -0700
+++ b/src/point-to-point-layout/model/point-to-point-grid.cc	Wed May 04 15:11:13 2011 -0700
@@ -28,7 +28,7 @@
 NS_LOG_COMPONENT_DEFINE("PointToPointGridHelper");
 
 namespace ns3 {
-  
+
 PointToPointGridHelper::PointToPointGridHelper (uint32_t nRows, 
                                                 uint32_t nCols, 
                                                 PointToPointHelper pointToPoint)
@@ -43,36 +43,36 @@
   InternetStackHelper stack;
 
   for (uint32_t y = 0; y < nRows; ++y)
-  {
-    NodeContainer rowNodes;
-    NetDeviceContainer rowDevices;
-    NetDeviceContainer colDevices;
+    {
+      NodeContainer rowNodes;
+      NetDeviceContainer rowDevices;
+      NetDeviceContainer colDevices;
 
-    for (uint32_t x = 0; x < nCols; ++x)
-    {
-      rowNodes.Create (1);
+      for (uint32_t x = 0; x < nCols; ++x)
+        {
+          rowNodes.Create (1);
 
-      // install p2p links across the row
-      if (x > 0)
-      {
-        rowDevices.Add (pointToPoint.
-            Install (rowNodes.Get (x-1), rowNodes.Get (x)));
-      }
+          // install p2p links across the row
+          if (x > 0)
+            {
+              rowDevices.Add (pointToPoint.
+                              Install (rowNodes.Get (x-1), rowNodes.Get (x)));
+            }
 
-      // install vertical p2p links
+          // install vertical p2p links
+          if (y > 0)
+            {
+              colDevices.Add(pointToPoint.
+                             Install ((m_nodes.at (y-1)).Get (x), rowNodes.Get (x)));
+            }
+        }
+
+      m_nodes.push_back (rowNodes);
+      m_rowDevices.push_back (rowDevices);
+
       if (y > 0)
-      {
-        colDevices.Add(pointToPoint.
-                      Install ((m_nodes.at (y-1)).Get (x), rowNodes.Get (x)));
-      }
+        m_colDevices.push_back (colDevices);
     }
-
-    m_nodes.push_back (rowNodes);
-    m_rowDevices.push_back (rowDevices);
-
-    if (y > 0)
-      m_colDevices.push_back (colDevices);
-  }
 }
 
 PointToPointGridHelper::~PointToPointGridHelper ()
@@ -131,7 +131,7 @@
 
 void
 PointToPointGridHelper::BoundingBox (double ulx, double uly,
-                         double lrx, double lry)
+                                     double lrx, double lry)
 {
   double xDist; 
   double yDist; 
@@ -155,24 +155,24 @@
   double yAdder = yDist / m_ySize;
   double yLoc = yDist / 2;
   for (uint32_t i = 0; i < m_ySize; ++i)
-  {
-    double xLoc = xDist / 2;
-    for (uint32_t j = 0; j < m_xSize; ++j)
     {
-      Ptr<Node> node = GetNode (i, j);
-      Ptr<ConstantPositionMobilityModel> loc = node->GetObject<ConstantPositionMobilityModel> ();
-      if (loc ==0)
-      {
-        loc = CreateObject<ConstantPositionMobilityModel> ();
-        node->AggregateObject (loc);
-      }
-      Vector locVec (xLoc, yLoc, 0);
-      loc->SetPosition (locVec);
+      double xLoc = xDist / 2;
+      for (uint32_t j = 0; j < m_xSize; ++j)
+        {
+          Ptr<Node> node = GetNode (i, j);
+          Ptr<ConstantPositionMobilityModel> loc = node->GetObject<ConstantPositionMobilityModel> ();
+          if (loc ==0)
+            {
+              loc = CreateObject<ConstantPositionMobilityModel> ();
+              node->AggregateObject (loc);
+            }
+          Vector locVec (xLoc, yLoc, 0);
+          loc->SetPosition (locVec);
 
-      xLoc += xAdder;
+          xLoc += xAdder;
+        }
+      yLoc += yAdder;
     }
-    yLoc += yAdder;
-  }
 }
 
 Ptr<Node> 
@@ -181,7 +181,7 @@
   if (row > m_nodes.size () - 1 || 
       col > m_nodes.at (row).GetN () - 1) 
     {
-       NS_FATAL_ERROR ("Index out of bounds in PointToPointGridHelper::GetNode.");
+      NS_FATAL_ERROR ("Index out of bounds in PointToPointGridHelper::GetNode.");
     }
 
   return (m_nodes.at (row)).Get (col);
@@ -193,7 +193,7 @@
   if (row > m_nodes.size () - 1 || 
       col > m_nodes.at (row).GetN () - 1) 
     {
-       NS_FATAL_ERROR ("Index out of bounds in PointToPointGridHelper::GetIpv4Address.");
+      NS_FATAL_ERROR ("Index out of bounds in PointToPointGridHelper::GetIpv4Address.");
     }
 
   // Right now this just gets one of the addresses of the
@@ -204,13 +204,13 @@
   // in which case the right (row) device address is 
   // returned
   if (col == 0)
-  {
-    return (m_rowInterfaces.at (row)).GetAddress (0);
-  }
+    {
+      return (m_rowInterfaces.at (row)).GetAddress (0);
+    }
   else
-  {
-    return (m_rowInterfaces.at (row)).GetAddress ((2*col)-1);
-  }
+    {
+      return (m_rowInterfaces.at (row)).GetAddress ((2*col)-1);
+    }
 }
 
 } // namespace ns3
--- a/src/point-to-point-layout/model/point-to-point-grid.h	Wed May 04 11:20:20 2011 -0700
+++ b/src/point-to-point-layout/model/point-to-point-grid.h	Wed May 04 15:11:13 2011 -0700
@@ -28,7 +28,7 @@
 #include "net-device-container.h"
 
 namespace ns3 {
-  
+
 /**
  * \brief A helper to make it easier to create a grid topology
  * with p2p links
@@ -121,5 +121,5 @@
 };
 
 } // namespace ns3
-      
+
 #endif /* POINT_TO_POINT_GRID_HELPER_H */
--- a/src/point-to-point-layout/model/point-to-point-star.cc	Wed May 04 11:20:20 2011 -0700
+++ b/src/point-to-point-layout/model/point-to-point-star.cc	Wed May 04 15:11:13 2011 -0700
@@ -29,9 +29,9 @@
 NS_LOG_COMPONENT_DEFINE("PointToPointStarHelper");
 
 namespace ns3 {
-  
+
 PointToPointStarHelper::PointToPointStarHelper (uint32_t numSpokes,
-                   PointToPointHelper p2pHelper)
+                                                PointToPointHelper p2pHelper)
 {
   m_hub.Create (1);
   m_spokes.Create (numSpokes);
@@ -71,7 +71,7 @@
   return m_spokeInterfaces.GetAddress (i);
 }
 
-uint32_t  
+uint32_t
 PointToPointStarHelper::SpokeCount () const
 {
   return m_spokes.GetN ();
@@ -149,10 +149,10 @@
           spokeLoc = CreateObject<ConstantPositionMobilityModel> ();
           spokeNode->AggregateObject (spokeLoc);
         }
-        Vector spokeVec (hubVec.x + cos (theta*i) * spokeDist, 
-                         hubVec.y + sin (theta*i) * spokeDist,
-                         0);
-        spokeLoc->SetPosition (spokeVec);
+      Vector spokeVec (hubVec.x + cos (theta*i) * spokeDist,
+                       hubVec.y + sin (theta*i) * spokeDist,
+                       0);
+      spokeLoc->SetPosition (spokeVec);
     }
 }
 
--- a/src/point-to-point-layout/model/point-to-point-star.h	Wed May 04 11:20:20 2011 -0700
+++ b/src/point-to-point-layout/model/point-to-point-star.h	Wed May 04 15:11:13 2011 -0700
@@ -27,7 +27,7 @@
 #include "ipv4-interface-container.h"
 
 namespace ns3 {
-  
+
 /**
  * \brief A helper to make it easier to create a star topology
  * with PointToPoint links