blob: 54edde6a09c69fbcc3accee832d48721520c3219 [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001#ifndef NLSR_MAP_HPP
2#define NLSR_MAP_HPP
3
4#include <iostream>
5#include <list>
6
7#include <ndn-cpp-dev/face.hpp>
8
akmhoqueb1710aa2014-02-19 17:13:36 -06009namespace nlsr {
10
akmhoque1a481092014-02-19 16:34:22 -060011class Nlsr;
akmhoque298385a2014-02-13 14:13:09 -060012
13using namespace std;
14
15class MapEntry
16{
17public:
18 MapEntry()
19 : router()
20 , mappingNumber(-1)
21 {
22 }
23
24 ~MapEntry()
25 {
26 }
27
28 MapEntry(string rtr, int mn)
29 {
30 router=rtr;
31 mappingNumber=mn;
32 }
33
34 string getRouter()
35 {
36 return router;
37 }
38
39 int getMappingNumber()
40 {
41 return mappingNumber;
42 }
43private:
44 string router;
45 int mappingNumber;
46};
47
48ostream&
49operator<<(ostream& os, MapEntry& mpe);
50
51class Map
52{
53public:
54 Map()
55 : mappingIndex(0)
56 {
57 }
58
59
60 void addMapElement(string& rtrName);
akmhoque1a481092014-02-19 16:34:22 -060061 void createMapFromAdjLsdb(Nlsr& pnlsr);
akmhoque298385a2014-02-13 14:13:09 -060062 string getRouterNameByMappingNo(int mn);
63 int getMappingNoByRouterName(string& rName);
64 void resetMap();
65 std::list< MapEntry >& getMapList()
66 {
67 return rMap;
68 }
69
70 int getMapSize()
71 {
72 return rMap.size();
73 }
74
75
76private:
77 bool addMapElement(MapEntry& mpe);
78
79 int mappingIndex;
80 std::list< MapEntry > rMap;
81};
82
83ostream&
84operator<<(ostream& os, Map& rMap);
85
akmhoqueb1710aa2014-02-19 17:13:36 -060086} // namespace nlsr
akmhoque298385a2014-02-13 14:13:09 -060087#endif