akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 1 | #ifndef NLSR_MAP_HPP |
2 | #define NLSR_MAP_HPP | ||||
3 | |||||
4 | #include <iostream> | ||||
5 | #include <list> | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 6 | #include <boost/cstdint.hpp> |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 7 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 8 | #include <ndn-cxx/common.hpp> |
9 | |||||
10 | #include "map-entry.hpp" | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 11 | |
12 | namespace nlsr { | ||||
13 | |||||
14 | class Nlsr; | ||||
15 | |||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 16 | class Map |
17 | { | ||||
18 | public: | ||||
19 | Map() | ||||
20 | : m_mappingIndex(0) | ||||
21 | { | ||||
22 | } | ||||
23 | |||||
24 | |||||
25 | void | ||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 26 | addEntry(const ndn::Name& rtrName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 27 | |
28 | void | ||||
29 | createFromAdjLsdb(Nlsr& pnlsr); | ||||
30 | |||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 31 | const ndn::Name |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 32 | getRouterNameByMappingNo(int32_t mn); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 33 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 34 | int32_t |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 35 | getMappingNoByRouterName(const ndn::Name& rName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 36 | |
37 | void | ||||
38 | reset(); | ||||
39 | |||||
40 | std::list<MapEntry>& | ||||
41 | getMapList() | ||||
42 | { | ||||
43 | return m_table; | ||||
44 | } | ||||
45 | |||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 46 | size_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 47 | getMapSize() const |
48 | { | ||||
49 | return m_table.size(); | ||||
50 | } | ||||
51 | |||||
52 | |||||
53 | private: | ||||
54 | bool | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 55 | addEntry(MapEntry& mpe); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 56 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 57 | int32_t m_mappingIndex; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 58 | std::list<MapEntry> m_table; |
59 | }; | ||||
60 | |||||
61 | std::ostream& | ||||
62 | operator<<(std::ostream& os, Map& map); | ||||
63 | |||||
64 | } // namespace nlsr | ||||
65 | #endif //NLSR_MAP_HPP |