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