blob: 1c8da329578d0f166da538e5041d813d1a4d7881 [file] [log] [blame]
akmhoque53353462014-04-22 08:43:45 -05001#ifndef NLSR_MAP_HPP
2#define NLSR_MAP_HPP
3
4#include <iostream>
5#include <list>
akmhoquefdbddb12014-05-02 18:35:19 -05006#include <boost/cstdint.hpp>
akmhoque53353462014-04-22 08:43:45 -05007
akmhoquefdbddb12014-05-02 18:35:19 -05008#include <ndn-cxx/common.hpp>
9
10#include "map-entry.hpp"
akmhoque53353462014-04-22 08:43:45 -050011
12namespace nlsr {
13
14class Nlsr;
15
akmhoque53353462014-04-22 08:43:45 -050016class Map
17{
18public:
19 Map()
20 : m_mappingIndex(0)
21 {
22 }
23
24
25 void
akmhoque31d1d4b2014-05-05 22:08:14 -050026 addEntry(const ndn::Name& rtrName);
akmhoque53353462014-04-22 08:43:45 -050027
28 void
29 createFromAdjLsdb(Nlsr& pnlsr);
30
akmhoque31d1d4b2014-05-05 22:08:14 -050031 const ndn::Name
akmhoquefdbddb12014-05-02 18:35:19 -050032 getRouterNameByMappingNo(int32_t mn);
akmhoque53353462014-04-22 08:43:45 -050033
akmhoquefdbddb12014-05-02 18:35:19 -050034 int32_t
akmhoque31d1d4b2014-05-05 22:08:14 -050035 getMappingNoByRouterName(const ndn::Name& rName);
akmhoque53353462014-04-22 08:43:45 -050036
37 void
38 reset();
39
40 std::list<MapEntry>&
41 getMapList()
42 {
43 return m_table;
44 }
45
akmhoque31d1d4b2014-05-05 22:08:14 -050046 size_t
akmhoque53353462014-04-22 08:43:45 -050047 getMapSize() const
48 {
49 return m_table.size();
50 }
51
52
53private:
54 bool
akmhoquefdbddb12014-05-02 18:35:19 -050055 addEntry(MapEntry& mpe);
akmhoque53353462014-04-22 08:43:45 -050056
akmhoquefdbddb12014-05-02 18:35:19 -050057 int32_t m_mappingIndex;
akmhoque53353462014-04-22 08:43:45 -050058 std::list<MapEntry> m_table;
59};
60
61std::ostream&
62operator<<(std::ostream& os, Map& map);
63
64} // namespace nlsr
65#endif //NLSR_MAP_HPP