blob: 7f73cac0a058fda5dba47030d67a12aef9ab8102 [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
akmhoque1a481092014-02-19 16:34:22 -06009class Nlsr;
akmhoque298385a2014-02-13 14:13:09 -060010
11using namespace std;
12
13class MapEntry
14{
15public:
16 MapEntry()
17 : router()
18 , mappingNumber(-1)
19 {
20 }
21
22 ~MapEntry()
23 {
24 }
25
26 MapEntry(string rtr, int mn)
27 {
28 router=rtr;
29 mappingNumber=mn;
30 }
31
32 string getRouter()
33 {
34 return router;
35 }
36
37 int getMappingNumber()
38 {
39 return mappingNumber;
40 }
41private:
42 string router;
43 int mappingNumber;
44};
45
46ostream&
47operator<<(ostream& os, MapEntry& mpe);
48
49class Map
50{
51public:
52 Map()
53 : mappingIndex(0)
54 {
55 }
56
57
58 void addMapElement(string& rtrName);
akmhoque1a481092014-02-19 16:34:22 -060059 void createMapFromAdjLsdb(Nlsr& pnlsr);
akmhoque298385a2014-02-13 14:13:09 -060060 string getRouterNameByMappingNo(int mn);
61 int getMappingNoByRouterName(string& rName);
62 void resetMap();
63 std::list< MapEntry >& getMapList()
64 {
65 return rMap;
66 }
67
68 int getMapSize()
69 {
70 return rMap.size();
71 }
72
73
74private:
75 bool addMapElement(MapEntry& mpe);
76
77 int mappingIndex;
78 std::list< MapEntry > rMap;
79};
80
81ostream&
82operator<<(ostream& os, Map& rMap);
83
84#endif