Point-to-point-layout code-style changes

This commit is contained in:
John Abraham committed 2011-05-04 15:11:13 -07:00
1 parent 5d80c7fa9c
commit 40ddf24bd4
6 files changed
+77 -77

No files matched your search

@@ -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 @@ PointToPointDumbbellHelper::PointToPointDumbbellHelper (uint32_t nLeftLeaf,
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 @@ PointToPointDumbbellHelper::PointToPointDumbbellHelper (uint32_t nLeftLeaf,
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::InstallStack (InternetStackHelper stack)
}
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::AssignIpv4Addresses (Ipv4AddressHelper leftIp,
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 @@ void PointToPointDumbbellHelper::BoundingBox (double ulx, double uly, // Upper l
}
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 @@ void PointToPointDumbbellHelper::BoundingBox (double ulx, double uly, // Upper l
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 @@ void PointToPointDumbbellHelper::BoundingBox (double ulx, double uly, // Upper l
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 @@ void PointToPointDumbbellHelper::BoundingBox (double ulx, double uly, // Upper l
theta += thetaR;
}
}
} // namespace ns3
@@ -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 @@ public:
* router
*/
Ptr<Node> GetLeft () const;
/**
* \returns pointer to the i'th left side leaf node
*/
@@ -138,7 +138,7 @@ public:
* \param lry lower right y value
*/
void BoundingBox (double ulx, double uly, double lrx, double lry);
private:
NodeContainer m_leftLeaf;
NetDeviceContainer m_leftLeafDevices;
@@ -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 @@ PointToPointGridHelper::PointToPointGridHelper (uint32_t nRows,
InternetStackHelper stack;
for (uint32_t y = 0; y < nRows; ++y)
{
NodeContainer rowNodes;
NetDeviceContainer rowDevices;
NetDeviceContainer colDevices;
for (uint32_t x = 0; x < nCols; ++x)
{
rowNodes.Create (1);
NodeContainer rowNodes;
NetDeviceContainer rowDevices;
NetDeviceContainer colDevices;
// install p2p links across the row
if (x > 0)
{
rowDevices.Add (pointToPoint.
Install (rowNodes.Get (x-1), rowNodes.Get (x)));
}
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 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);
// install vertical p2p links
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 @@ PointToPointGridHelper::AssignIpv4Addresses (Ipv4AddressHelper rowIp, Ipv4Addres
void
PointToPointGridHelper::BoundingBox (double ulx, double uly,
double lrx, double lry)
double lrx, double lry)
{
double xDist;
double yDist;
@@ -155,24 +155,24 @@ PointToPointGridHelper::BoundingBox (double ulx, double uly,
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 @@ PointToPointGridHelper::GetNode (uint32_t row, uint32_t col)
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 @@ PointToPointGridHelper::GetIpv4Address (uint32_t row, uint32_t col)
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 @@ PointToPointGridHelper::GetIpv4Address (uint32_t row, uint32_t col)
// 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
@@ -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 @@ private:
};
} // namespace ns3
#endif /* POINT_TO_POINT_GRID_HELPER_H */
@@ -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 @@ PointToPointStarHelper::GetSpokeIpv4Address (uint32_t i) const
return m_spokeInterfaces.GetAddress (i);
}
uint32_t
uint32_t
PointToPointStarHelper::SpokeCount () const
{
return m_spokes.GetN ();
@@ -149,10 +149,10 @@ PointToPointStarHelper::BoundingBox (double ulx, double uly,
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);
}
}
@@ -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