akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 1 | #include <string> |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 2 | #include <boost/cstdint.hpp> |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 3 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 4 | #ifndef NLSR_ADJACENT_HPP |
| 5 | #define NLSR_ADJACENT_HPP |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 6 | |
| 7 | namespace nlsr { |
| 8 | class Adjacent |
| 9 | { |
| 10 | |
| 11 | public: |
| 12 | Adjacent() |
| 13 | : m_name("") |
| 14 | , m_connectingFace(0) |
| 15 | , m_linkCost(10.0) |
| 16 | , m_status(0) |
| 17 | , m_interestTimedOutNo(0) |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | Adjacent(const std::string& an) |
| 22 | : m_connectingFace(0) |
| 23 | , m_linkCost(0.0) |
| 24 | , m_status(0) |
| 25 | , m_interestTimedOutNo(0) |
| 26 | { |
| 27 | m_name = an; |
| 28 | } |
| 29 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 30 | Adjacent(const std::string& an, uint32_t cf, double lc, uint32_t s, uint32_t iton); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 31 | |
| 32 | std::string |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 33 | getName() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 34 | { |
| 35 | return m_name; |
| 36 | } |
| 37 | |
| 38 | void |
| 39 | setName(const std::string& an) |
| 40 | { |
| 41 | m_name = an; |
| 42 | } |
| 43 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 44 | uint32_t |
| 45 | getConnectingFace() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 46 | { |
| 47 | return m_connectingFace; |
| 48 | } |
| 49 | |
| 50 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 51 | setConnectingFace(uint32_t cf) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 52 | { |
| 53 | m_connectingFace = cf; |
| 54 | } |
| 55 | |
| 56 | double |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 57 | getLinkCost() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 58 | { |
| 59 | return m_linkCost; |
| 60 | } |
| 61 | |
| 62 | void |
| 63 | setLinkCost(double lc) |
| 64 | { |
| 65 | m_linkCost = lc; |
| 66 | } |
| 67 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 68 | uint32_t |
| 69 | getStatus() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 70 | { |
| 71 | return m_status; |
| 72 | } |
| 73 | |
| 74 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 75 | setStatus(uint32_t s) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 76 | { |
| 77 | m_status = s; |
| 78 | } |
| 79 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 80 | uint32_t |
| 81 | getInterestTimedOutNo() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 82 | { |
| 83 | return m_interestTimedOutNo; |
| 84 | } |
| 85 | |
| 86 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 87 | setInterestTimedOutNo(uint32_t iton) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 88 | { |
| 89 | m_interestTimedOutNo = iton; |
| 90 | } |
| 91 | |
| 92 | bool |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 93 | operator==(const Adjacent& adjacent) const; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 94 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 95 | bool |
| 96 | compareName(const Adjacent& adjacent); |
| 97 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 98 | private: |
| 99 | std::string m_name; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 100 | uint32_t m_connectingFace; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 101 | double m_linkCost; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 102 | uint32_t m_status; |
| 103 | uint32_t m_interestTimedOutNo; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | std::ostream& |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 107 | operator<<(std::ostream& os, const Adjacent& adj); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 108 | |
| 109 | } // namespace nlsr |
| 110 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 111 | #endif //NLSR_ADJACENT_HPP |