akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 1 | #include<iostream> |
| 2 | #include<string> |
| 3 | #include<cmath> |
| 4 | #include<limits> |
| 5 | |
| 6 | #include "nlsr_adjacent.hpp" |
| 7 | |
akmhoque | b1710aa | 2014-02-19 17:13:36 -0600 | [diff] [blame^] | 8 | namespace nlsr { |
| 9 | |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 10 | using namespace std; |
| 11 | |
| 12 | Adjacent::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 | |
| 20 | bool |
| 21 | Adjacent::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 | |
| 29 | std::ostream& |
| 30 | operator << (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 | } |
akmhoque | b1710aa | 2014-02-19 17:13:36 -0600 | [diff] [blame^] | 38 | |
| 39 | } //namespace nlsr |