akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 1 | #ifndef NLSR_NEXTHOP_HPP |
2 | #define NLSR_NEXTHOP_HPP | ||||
3 | |||||
4 | #include <iostream> | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 5 | #include <boost/cstdint.hpp> |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 6 | |
7 | namespace nlsr { | ||||
8 | class NextHop | ||||
9 | { | ||||
10 | public: | ||||
11 | NextHop() | ||||
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 12 | : m_connectingFaceUri() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 13 | , m_routeCost(0) |
14 | { | ||||
15 | } | ||||
16 | |||||
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 17 | NextHop(const std::string& cfu, double rc) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 18 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 19 | m_connectingFaceUri = cfu; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 20 | m_routeCost = rc; |
21 | } | ||||
22 | |||||
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 23 | const std::string& |
24 | getConnectingFaceUri() const | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 25 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 26 | return m_connectingFaceUri; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 27 | } |
28 | |||||
29 | void | ||||
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 30 | setConnectingFaceUri(const std::string& cfu) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 31 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 32 | m_connectingFaceUri = cfu; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 33 | } |
34 | |||||
35 | double | ||||
36 | getRouteCost() const | ||||
37 | { | ||||
38 | return m_routeCost; | ||||
39 | } | ||||
40 | |||||
41 | void | ||||
42 | setRouteCost(double rc) | ||||
43 | { | ||||
44 | m_routeCost = rc; | ||||
45 | } | ||||
46 | |||||
47 | private: | ||||
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 48 | std::string m_connectingFaceUri; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 49 | double m_routeCost; |
50 | }; | ||||
51 | |||||
52 | |||||
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 53 | inline std::ostream& |
54 | operator<<(std::ostream& os, const NextHop& nh) | ||||
55 | { | ||||
56 | os << "Face: " << nh.getConnectingFaceUri() << " Route Cost: " << | ||||
57 | nh.getRouteCost(); | ||||
58 | return os; | ||||
59 | } | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 60 | |
61 | }//namespace nlsr | ||||
62 | |||||
63 | #endif //NLSR_NEXTHOP_HPP |