| #include <iostream> |
| #include <string> |
| #include <cmath> |
| #include <limits> |
| |
| #include "adjacent.hpp" |
| |
| namespace nlsr { |
| |
| using namespace std; |
| |
| Adjacent::Adjacent(const string& an, int cf, double lc, int s, int iton) |
| { |
| m_name = an; |
| m_connectingFace = cf; |
| m_linkCost = lc; |
| m_status = s; |
| m_interestTimedOutNo = iton; |
| } |
| |
| bool |
| Adjacent::isEqual(Adjacent& adj) |
| { |
| return (m_name == adj.getName()) && |
| (m_connectingFace == adj.getConnectingFace()) && |
| (std::abs(m_linkCost - adj.getLinkCost()) < |
| std::numeric_limits<double>::epsilon()) ; |
| } |
| |
| std::ostream& |
| operator<<(std::ostream& os, Adjacent& adj) |
| { |
| os << "Adjacent : " << adj.getName() << endl; |
| os << "Connecting Face: " << adj.getConnectingFace() << endl; |
| os << "Link Cost: " << adj.getLinkCost() << endl; |
| os << "Status: " << adj.getStatus() << endl; |
| os << "Interest Timed out: " << adj.getInterestTimedOutNo() << endl; |
| return os; |
| } |
| |
| } //namespace nlsr |