blob: 6b0b1c010be15ba8cbfe6932ebbb1be3f8d464a9 [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001#include<iostream>
2#include<string>
3#include<cmath>
4#include<limits>
5
6#include "nlsr_adjacent.hpp"
7
akmhoqueb1710aa2014-02-19 17:13:36 -06008namespace nlsr {
9
akmhoque298385a2014-02-13 14:13:09 -060010using namespace std;
11
12Adjacent::Adjacent(const string& an, int cf, double lc, int s, int iton){
13 adjacentName=an;
14 connectingFace=cf;
15 linkCost=lc;
16 status=s;
17 interestTimedOutNo=iton;
18}
19
20bool
21Adjacent::isAdjacentEqual(Adjacent& adj)
22{
23 return ( adjacentName == adj.getAdjacentName() ) &&
24 ( connectingFace == adj.getConnectingFace() ) &&
25 (std::abs(linkCost - adj.getLinkCost()) <
26 std::numeric_limits<double>::epsilon()) ;
27}
28
29std::ostream&
30operator << (std::ostream &os, Adjacent &adj){
31 cout<<"Adjacent : "<< adj.getAdjacentName() << endl;
32 cout<<"Connecting Face: "<<adj.getConnectingFace()<<endl;
33 cout<<"Link Cost: "<<adj.getLinkCost()<<endl;
34 cout<<"Status: "<<adj.getStatus()<<endl;
35 cout<<"Interest Timed out: "<<adj.getInterestTimedOutNo()<<endl;
36 return os;
37}
akmhoqueb1710aa2014-02-19 17:13:36 -060038
39} //namespace nlsr