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