blob: 807eb0b134afdad8c2015e32cdf0678f1480da9b [file] [log] [blame]
akmhoque53353462014-04-22 08:43:45 -05001#include <iostream>
2#include <string>
3#include <cmath>
4#include <limits>
5#include "adjacent.hpp"
6
7namespace nlsr {
8
9using namespace std;
10
11Adjacent::Adjacent(const string& an, int cf, double lc, int s, int iton)
12{
13 m_name = an;
14 m_connectingFace = cf;
15 m_linkCost = lc;
16 m_status = s;
17 m_interestTimedOutNo = iton;
18}
19
20bool
21Adjacent::isEqual(Adjacent& adj)
22{
23 return (m_name == adj.getName()) &&
24 (m_connectingFace == adj.getConnectingFace()) &&
25 (std::abs(m_linkCost - adj.getLinkCost()) <
26 std::numeric_limits<double>::epsilon()) ;
27}
28
29std::ostream&
30operator<<(std::ostream& os, Adjacent& adj)
31{
32 os << "Adjacent : " << adj.getName() << endl;
33 os << "Connecting Face: " << adj.getConnectingFace() << endl;
34 os << "Link Cost: " << adj.getLinkCost() << endl;
35 os << "Status: " << adj.getStatus() << endl;
36 os << "Interest Timed out: " << adj.getInterestTimedOutNo() << endl;
37 return os;
38}
39
40} //namespace nlsr