akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 1 | #ifndef NLSR_ADJACENCY_LIST_HPP |
2 | #define NLSR_ADJACENCY_LIST_HPP | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 3 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 4 | #include <list> |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 5 | #include <boost/cstdint.hpp> |
6 | #include <ndn-cxx/common.hpp> | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 7 | |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 8 | #include "adjacent.hpp" |
9 | |||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 10 | namespace nlsr { |
11 | class Nlsr; | ||||
12 | |||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 13 | class AdjacencyList |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 14 | { |
15 | |||||
16 | public: | ||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 17 | AdjacencyList(); |
18 | ~AdjacencyList(); | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 19 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 20 | int32_t |
21 | insert(Adjacent& adjacent); | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 22 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 23 | int32_t |
24 | updateAdjacentStatus(const std::string& adjName, int32_t s); | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 25 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 26 | int32_t |
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame] | 27 | updateAdjacentLinkCost(const std::string& adjName, double lc); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 28 | |
29 | std::list<Adjacent>& | ||||
30 | getAdjList(); | ||||
31 | |||||
32 | bool | ||||
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame] | 33 | isNeighbor(const std::string& adjName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 34 | |
35 | void | ||||
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame] | 36 | incrementTimedOutInterestCount(const std::string& neighbor); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 37 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 38 | int32_t |
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame] | 39 | getTimedOutInterestCount(const std::string& neighbor); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 40 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 41 | uint32_t |
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame] | 42 | getStatusOfNeighbor(const std::string& neighbor); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 43 | |
44 | void | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 45 | setStatusOfNeighbor(const std::string& neighbor, int32_t status); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 46 | |
47 | void | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 48 | setTimedOutInterestCount(const std::string& neighbor, uint32_t count); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 49 | |
50 | void | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 51 | addAdjacents(AdjacencyList& adl); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 52 | |
53 | bool | ||||
54 | isAdjLsaBuildable(Nlsr& pnlsr); | ||||
55 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 56 | int32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 57 | getNumOfActiveNeighbor(); |
58 | |||||
59 | Adjacent | ||||
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame] | 60 | getAdjacent(const std::string& adjName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 61 | |
62 | bool | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 63 | operator==(AdjacencyList& adl); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 64 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 65 | size_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 66 | getSize() |
67 | { | ||||
68 | return m_adjList.size(); | ||||
69 | } | ||||
70 | |||||
71 | void | ||||
72 | reset() | ||||
73 | { | ||||
74 | if (m_adjList.size() > 0) | ||||
75 | { | ||||
76 | m_adjList.clear(); | ||||
77 | } | ||||
78 | } | ||||
79 | |||||
80 | void | ||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 81 | print(); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 82 | |
83 | private: | ||||
84 | std::list<Adjacent>::iterator | ||||
85 | find(std::string adjName); | ||||
86 | |||||
87 | private: | ||||
88 | std::list<Adjacent> m_adjList; | ||||
89 | }; | ||||
90 | |||||
91 | } //namespace nlsr | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 92 | #endif //NLSR_ADJACENCY_LIST_HPP |