blob: 8a1c048f0fc56418ff81d224636f4ce4f23256e8 [file] [log] [blame]
akmhoque87347a32014-01-31 11:00:44 -06001#include<iostream>
2#include<string>
akmhoque4768f892014-02-08 23:58:07 -06003#include<cmath>
4#include<limits>
akmhoque87347a32014-01-31 11:00:44 -06005
akmhoque204e7542014-01-31 16:08:25 -06006#include "nlsr_adjacent.hpp"
akmhoque87347a32014-01-31 11:00:44 -06007
8using namespace std;
9
10Adjacent::Adjacent(const string& an, int cf, double lc, int s, int iton){
11 adjacentName=an;
12 connectingFace=cf;
13 linkCost=lc;
14 status=s;
15 interestTimedOutNo=iton;
16}
17
akmhoque4768f892014-02-08 23:58:07 -060018bool
19Adjacent::isAdjacentEqual(Adjacent& adj)
20{
21 return ( adjacentName == adj.getAdjacentName() ) &&
22 ( connectingFace == adj.getConnectingFace() ) &&
23 (std::abs(linkCost - adj.getLinkCost()) <
24 std::numeric_limits<double>::epsilon()) ;
25}
26
akmhoque87347a32014-01-31 11:00:44 -060027std::ostream&
28operator << (std::ostream &os, Adjacent &adj){
29 cout<<"Adjacent : "<< adj.getAdjacentName() << endl;
30 cout<<"Connecting Face: "<<adj.getConnectingFace()<<endl;
31 cout<<"Link Cost: "<<adj.getLinkCost()<<endl;
32 cout<<"Status: "<<adj.getStatus()<<endl;
33 cout<<"Interest Timed out: "<<adj.getInterestTimedOutNo()<<endl;
34 return os;
35}