nlsr: refactor Adjacent to use FaceUri objects
Change-Id: Ib46f70570669c381572182eeea5c047a38a05104
refs: #4063
diff --git a/src/adjacent.cpp b/src/adjacent.cpp
index fb22ed3..55ddff5 100644
--- a/src/adjacent.cpp
+++ b/src/adjacent.cpp
@@ -16,9 +16,6 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- *
- * \author A K M Mahmudul Hoque <ahoque1@memphis.edu>
- *
**/
#include <iostream>
#include <string>
@@ -33,13 +30,11 @@
INIT_LOGGER("Adjacent");
-using namespace std;
-
const float Adjacent::DEFAULT_LINK_COST = 10.0;
Adjacent::Adjacent()
: m_name()
- , m_connectingFaceUri()
+ , m_faceUri()
, m_linkCost(DEFAULT_LINK_COST)
, m_status(STATUS_INACTIVE)
, m_interestTimedOutNo(0)
@@ -49,7 +44,7 @@
Adjacent::Adjacent(const ndn::Name& an)
: m_name(an)
- , m_connectingFaceUri()
+ , m_faceUri()
, m_linkCost(DEFAULT_LINK_COST)
, m_status(STATUS_INACTIVE)
, m_interestTimedOutNo(0)
@@ -57,32 +52,31 @@
{
}
-Adjacent::Adjacent(const ndn::Name& an, const std::string& cfu, double lc,
+Adjacent::Adjacent(const ndn::Name& an, const ndn::util::FaceUri& faceUri, double lc,
Status s, uint32_t iton, uint64_t faceId)
: m_name(an)
- , m_connectingFaceUri(cfu)
+ , m_faceUri(faceUri)
, m_linkCost(lc)
, m_status(s)
, m_interestTimedOutNo(iton)
, m_faceId(faceId)
{
-
}
bool
Adjacent::operator==(const Adjacent& adjacent) const
{
return (m_name == adjacent.getName()) &&
- (m_connectingFaceUri == adjacent.getConnectingFaceUri()) &&
+ (m_faceUri == adjacent.getFaceUri()) &&
(std::abs(m_linkCost - adjacent.getLinkCost()) <
- std::numeric_limits<double>::epsilon()) ;
+ std::numeric_limits<double>::epsilon());
}
void
Adjacent::writeLog()
{
_LOG_DEBUG("Adjacent : " << m_name);
- _LOG_DEBUG("Connecting FaceUri: " << m_connectingFaceUri);
+ _LOG_DEBUG("Connecting FaceUri: " << m_faceUri);
_LOG_DEBUG("Link Cost: " << m_linkCost);
_LOG_DEBUG("Status: " << m_status);
_LOG_DEBUG("Interest Timed out: " << m_interestTimedOutNo);