Fixing Coding Style
diff --git a/src/nlsr_adl.cpp b/src/nlsr_adl.cpp
index ab5db84..fd84f9e 100644
--- a/src/nlsr_adl.cpp
+++ b/src/nlsr_adl.cpp
@@ -4,6 +4,9 @@
#include "nlsr_adl.hpp"
#include "nlsr_adjacent.hpp"
#include "nlsr.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_adl.cpp"
namespace nlsr
{
@@ -19,20 +22,20 @@
static bool
adjacent_compare(Adjacent& adj1, Adjacent& adj2)
{
- return adj1.getAdjacentName()==adj2.getAdjacentName();
+ return adj1.getName()==adj2.getName();
}
int
Adl::insert(Adjacent& adj)
{
- std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
- adjList.end(),
+ std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+ m_adjList.end(),
bind(&adjacent_compare, _1, adj));
- if ( it != adjList.end() )
+ if ( it != m_adjList.end() )
{
return -1;
}
- adjList.push_back(adj);
+ m_adjList.push_back(adj);
return 0;
}
@@ -50,10 +53,10 @@
Adl::updateAdjacentStatus(string adjName, int s)
{
Adjacent adj(adjName);
- std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
- adjList.end(),
+ std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+ m_adjList.end(),
bind(&adjacent_compare, _1, adj));
- if( it == adjList.end())
+ if( it == m_adjList.end())
{
return -1;
}
@@ -65,10 +68,10 @@
Adl::getAdjacent(string adjName)
{
Adjacent adj(adjName);
- std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
- adjList.end(),
+ std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+ m_adjList.end(),
bind(&adjacent_compare, _1, adj));
- if( it != adjList.end())
+ if( it != m_adjList.end())
{
return (*it);
}
@@ -77,28 +80,28 @@
bool
- Adl::isAdlEqual(Adl &adl)
+ Adl::isEqual(Adl& adl)
{
- if ( getAdlSize() != adl.getAdlSize() )
+ if ( getSize() != adl.getSize() )
{
return false;
}
- adjList.sort(adjacent_compare);
+ m_adjList.sort(adjacent_compare);
adl.getAdjList().sort(adjacent_compare);
int equalAdjCount=0;
std::list< Adjacent > adjList2=adl.getAdjList();
std::list<Adjacent>::iterator it1;
std::list<Adjacent>::iterator it2;
- for(it1=adjList.begin() , it2=adjList2.begin() ;
- it1!=adjList.end(); it1++,it2++)
+ for(it1=m_adjList.begin() , it2=adjList2.begin() ;
+ it1!=m_adjList.end(); it1++,it2++)
{
- if ( !(*it1).isAdjacentEqual((*it2)) )
+ if ( !(*it1).isEqual((*it2)) )
{
break;
}
equalAdjCount++;
}
- return equalAdjCount==getAdlSize();
+ return equalAdjCount==getSize();
}
@@ -106,10 +109,10 @@
Adl::updateAdjacentLinkCost(string adjName, double lc)
{
Adjacent adj(adjName);
- std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
- adjList.end(),
+ std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+ m_adjList.end(),
bind(&adjacent_compare, _1, adj));
- if( it == adjList.end())
+ if( it == m_adjList.end())
{
return -1;
}
@@ -121,10 +124,10 @@
Adl::isNeighbor(string adjName)
{
Adjacent adj(adjName);
- std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
- adjList.end(),
+ std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+ m_adjList.end(),
bind(&adjacent_compare, _1, adj));
- if( it == adjList.end())
+ if( it == m_adjList.end())
{
return false;
}
@@ -135,10 +138,10 @@
Adl::incrementTimedOutInterestCount(string& neighbor)
{
Adjacent adj(neighbor);
- std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
- adjList.end(),
+ std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+ m_adjList.end(),
bind(&adjacent_compare, _1, adj));
- if( it == adjList.end())
+ if( it == m_adjList.end())
{
return ;
}
@@ -149,10 +152,10 @@
Adl::setTimedOutInterestCount(string& neighbor, int count)
{
Adjacent adj(neighbor);
- std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
- adjList.end(),
+ std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+ m_adjList.end(),
bind(&adjacent_compare, _1, adj));
- if( it != adjList.end())
+ if( it != m_adjList.end())
{
(*it).setInterestTimedOutNo(count);
}
@@ -162,10 +165,10 @@
Adl::getTimedOutInterestCount(string& neighbor)
{
Adjacent adj(neighbor);
- std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
- adjList.end(),
+ std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+ m_adjList.end(),
bind(&adjacent_compare, _1, adj));
- if( it == adjList.end())
+ if( it == m_adjList.end())
{
return -1;
}
@@ -176,10 +179,10 @@
Adl::getStatusOfNeighbor(string& neighbor)
{
Adjacent adj(neighbor);
- std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
- adjList.end(),
+ std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+ m_adjList.end(),
bind(&adjacent_compare, _1, adj));
- if( it == adjList.end())
+ if( it == m_adjList.end())
{
return -1;
}
@@ -190,10 +193,10 @@
Adl::setStatusOfNeighbor(string& neighbor, int status)
{
Adjacent adj(neighbor);
- std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
- adjList.end(),
+ std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+ m_adjList.end(),
bind(&adjacent_compare, _1, adj));
- if( it != adjList.end())
+ if( it != m_adjList.end())
{
(*it).setStatus(status);
}
@@ -202,15 +205,15 @@
std::list<Adjacent>&
Adl::getAdjList()
{
- return adjList;
+ return m_adjList;
}
bool
Adl::isAdjLsaBuildable(Nlsr& pnlsr)
{
int nbrCount=0;
- for( std::list<Adjacent>::iterator it=adjList.begin();
- it!= adjList.end() ; it++)
+ for( std::list<Adjacent>::iterator it=m_adjList.begin();
+ it!= m_adjList.end() ; it++)
{
if ( ((*it).getStatus() == 1 ) )
{
@@ -225,7 +228,7 @@
}
}
}
- if( nbrCount == adjList.size())
+ if( nbrCount == m_adjList.size())
{
return true;
}
@@ -236,8 +239,8 @@
Adl::getNumOfActiveNeighbor()
{
int actNbrCount=0;
- for( std::list<Adjacent>::iterator it=adjList.begin();
- it!= adjList.end() ; it++)
+ for( std::list<Adjacent>::iterator it=m_adjList.begin();
+ it!= m_adjList.end() ; it++)
{
if ( ((*it).getStatus() == 1 ) )
{
@@ -251,7 +254,7 @@
void
Adl::printAdl()
{
- for( std::list<Adjacent>::iterator it=adjList.begin(); it!= adjList.end() ;
+ for( std::list<Adjacent>::iterator it=m_adjList.begin(); it!= m_adjList.end() ;
it++)
{
cout<< (*it) <<endl;