blob: 6cc4db0fec359136fc54a16095ac50bd7e3de2b6 [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
akmhoque1fd8c1e2014-02-19 19:41:49 -06008namespace nlsr
akmhoque298385a2014-02-13 14:13:09 -06009{
akmhoque298385a2014-02-13 14:13:09 -060010
akmhoque1fd8c1e2014-02-19 19:41:49 -060011 using namespace std;
12
13 Adjacent::Adjacent(const string& an, int cf, double lc, int s, int iton)
14 {
15 adjacentName=an;
16 connectingFace=cf;
17 linkCost=lc;
18 status=s;
19 interestTimedOutNo=iton;
20 }
21
22 bool
23 Adjacent::isAdjacentEqual(Adjacent& adj)
24 {
25 return ( adjacentName == adj.getAdjacentName() ) &&
26 ( connectingFace == adj.getConnectingFace() ) &&
27 (std::abs(linkCost - adj.getLinkCost()) <
28 std::numeric_limits<double>::epsilon()) ;
29 }
30
31 std::ostream&
32 operator << (std::ostream &os, Adjacent &adj)
33 {
34 cout<<"Adjacent : "<< adj.getAdjacentName() << endl;
35 cout<<"Connecting Face: "<<adj.getConnectingFace()<<endl;
36 cout<<"Link Cost: "<<adj.getLinkCost()<<endl;
37 cout<<"Status: "<<adj.getStatus()<<endl;
38 cout<<"Interest Timed out: "<<adj.getInterestTimedOutNo()<<endl;
39 return os;
40 }
akmhoqueb1710aa2014-02-19 17:13:36 -060041
42} //namespace nlsr