blob: 8a1c048f0fc56418ff81d224636f4ce4f23256e8 [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
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
18bool
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
27std::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}