blob: 0352d1da7d327bfab4c7c8d7385ec400bfc2a858 [file] [log] [blame]
#ifndef NLSR_MAP_HPP
#define NLSR_MAP_HPP
#include <iostream>
#include <list>
#include <ndn-cpp-dev/face.hpp>
namespace nlsr
{
class Nlsr;
using namespace std;
class MapEntry
{
public:
MapEntry()
: router()
, mappingNumber(-1)
{
}
~MapEntry()
{
}
MapEntry(string rtr, int mn)
{
router=rtr;
mappingNumber=mn;
}
string getRouter()
{
return router;
}
int getMappingNumber()
{
return mappingNumber;
}
private:
string router;
int mappingNumber;
};
ostream&
operator<<(ostream& os, MapEntry& mpe);
class Map
{
public:
Map()
: mappingIndex(0)
{
}
void addMapElement(string& rtrName);
void createMapFromAdjLsdb(Nlsr& pnlsr);
string getRouterNameByMappingNo(int mn);
int getMappingNoByRouterName(string& rName);
void resetMap();
std::list< MapEntry >& getMapList()
{
return rMap;
}
int getMapSize()
{
return rMap.size();
}
private:
bool addMapElement(MapEntry& mpe);
int mappingIndex;
std::list< MapEntry > rMap;
};
ostream&
operator<<(ostream& os, Map& rMap);
} // namespace nlsr
#endif