Fixing Coding Style
diff --git a/src/route/nlsr_map.cpp b/src/route/nlsr_map.cpp
index 19c57c1..f08f1ae 100644
--- a/src/route/nlsr_map.cpp
+++ b/src/route/nlsr_map.cpp
@@ -6,6 +6,9 @@
#include "nlsr_lsa.hpp"
#include "nlsr_lsdb.hpp"
#include "nlsr_map.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_map.cpp"
namespace nlsr
{
@@ -33,25 +36,25 @@
}
void
- Map::addMapElement(string& rtrName)
+ Map::addElement(string& rtrName)
{
- MapEntry me(rtrName,mappingIndex);
- if ( addMapElement(me) )
+ MapEntry me(rtrName,m_mappingIndex);
+ if ( addElement(me) )
{
- mappingIndex++;
+ m_mappingIndex++;
}
}
bool
- Map::addMapElement(MapEntry& mpe)
+ Map::addElement(MapEntry& mpe)
{
//cout << mpe;
- std::list<MapEntry >::iterator it = std::find_if( rMap.begin(),
- rMap.end(),
+ std::list<MapEntry >::iterator it = std::find_if( m_table.begin(),
+ m_table.end(),
bind(&mapEntryCompareByRouter, _1, mpe.getRouter()));
- if ( it == rMap.end() )
+ if ( it == m_table.end() )
{
- rMap.push_back(mpe);
+ m_table.push_back(mpe);
return true;
}
return false;
@@ -60,10 +63,10 @@
string
Map::getRouterNameByMappingNo(int mn)
{
- std::list<MapEntry >::iterator it = std::find_if( rMap.begin(),
- rMap.end(),
+ std::list<MapEntry >::iterator it = std::find_if( m_table.begin(),
+ m_table.end(),
bind(&mapEntryCompareByMappingNo, _1, mn));
- if ( it != rMap.end() )
+ if ( it != m_table.end() )
{
return (*it).getRouter();
}
@@ -73,10 +76,10 @@
int
Map::getMappingNoByRouterName(string& rName)
{
- std::list<MapEntry >::iterator it = std::find_if( rMap.begin(),
- rMap.end(),
+ std::list<MapEntry >::iterator it = std::find_if( m_table.begin(),
+ m_table.end(),
bind(&mapEntryCompareByRouter, _1, rName));
- if ( it != rMap.end() )
+ if ( it != m_table.end() )
{
return (*it).getMappingNumber();
}
@@ -84,36 +87,36 @@
}
void
- Map::createMapFromAdjLsdb(Nlsr& pnlsr)
+ Map::createFromAdjLsdb(Nlsr& pnlsr)
{
std::list<AdjLsa> adjLsdb=pnlsr.getLsdb().getAdjLsdb();
for( std::list<AdjLsa>::iterator it=adjLsdb.begin();
it!= adjLsdb.end() ; it++)
{
string linkStartRouter=(*it).getOrigRouter();
- addMapElement(linkStartRouter);
+ addElement(linkStartRouter);
std::list<Adjacent> adl=(*it).getAdl().getAdjList();
for( std::list<Adjacent>::iterator itAdl=adl.begin();
itAdl!= adl.end() ; itAdl++)
{
- string linkEndRouter=(*itAdl).getAdjacentName();
- addMapElement(linkEndRouter);
+ string linkEndRouter=(*itAdl).getName();
+ addElement(linkEndRouter);
}
}
}
void
- Map::resetMap()
+ Map::reset()
{
- rMap.clear();
- mappingIndex=0;
+ m_table.clear();
+ m_mappingIndex=0;
}
ostream&
- operator<<(ostream& os, Map& rMap)
+ operator<<(ostream& os, Map& map)
{
os<<"---------------Map----------------------"<<endl;
- std::list< MapEntry > ml=rMap.getMapList();
+ std::list< MapEntry > ml=map.getMapList();
for( std::list<MapEntry>::iterator it=ml.begin(); it!= ml.end() ; it++)
{
os<< (*it);