src: Replace Tokenizer with the methods of ndn::Name
Purpose of this commit is to replace Tokenizer in all
places except conf-file-processor.*pp with the methods
of ndn::Name. One static method in class NameHelper
is added. Tokenizer will be removed finally when
configuration file parsing commit is complete.
Refs: 1533
Change-Id: I14a67655eb963c5cc5b045c3c9f7d516e405ff19
diff --git a/src/adjacency-list.cpp b/src/adjacency-list.cpp
index a529b17..117ba76 100644
--- a/src/adjacency-list.cpp
+++ b/src/adjacency-list.cpp
@@ -1,6 +1,6 @@
#include <iostream>
#include <algorithm>
-
+#include <ndn-cxx/common.hpp>
#include "adjacency-list.hpp"
#include "adjacent.hpp"
#include "nlsr.hpp"
@@ -41,7 +41,7 @@
}
int32_t
-AdjacencyList::updateAdjacentStatus(const string& adjName, int32_t s)
+AdjacencyList::updateAdjacentStatus(const ndn::Name& adjName, int32_t s)
{
std::list<Adjacent>::iterator it = find(adjName);
if (it == m_adjList.end())
@@ -53,7 +53,7 @@
}
Adjacent
-AdjacencyList::getAdjacent(const string& adjName)
+AdjacencyList::getAdjacent(const ndn::Name& adjName)
{
Adjacent adj(adjName);
std::list<Adjacent>::iterator it = find(adjName);
@@ -96,7 +96,7 @@
}
int32_t
-AdjacencyList::updateAdjacentLinkCost(const string& adjName, double lc)
+AdjacencyList::updateAdjacentLinkCost(const ndn::Name& adjName, double lc)
{
std::list<Adjacent>::iterator it = find(adjName);
if (it == m_adjList.end())
@@ -108,7 +108,7 @@
}
bool
-AdjacencyList::isNeighbor(const string& adjName)
+AdjacencyList::isNeighbor(const ndn::Name& adjName)
{
std::list<Adjacent>::iterator it = find(adjName);
if (it == m_adjList.end())
@@ -119,7 +119,7 @@
}
void
-AdjacencyList::incrementTimedOutInterestCount(const string& neighbor)
+AdjacencyList::incrementTimedOutInterestCount(const ndn::Name& neighbor)
{
std::list<Adjacent>::iterator it = find(neighbor);
if (it == m_adjList.end())
@@ -130,7 +130,8 @@
}
void
-AdjacencyList::setTimedOutInterestCount(const string& neighbor, uint32_t count)
+AdjacencyList::setTimedOutInterestCount(const ndn::Name& neighbor,
+ uint32_t count)
{
std::list<Adjacent>::iterator it = find(neighbor);
if (it != m_adjList.end())
@@ -140,7 +141,7 @@
}
int32_t
-AdjacencyList::getTimedOutInterestCount(const string& neighbor)
+AdjacencyList::getTimedOutInterestCount(const ndn::Name& neighbor)
{
std::list<Adjacent>::iterator it = find(neighbor);
if (it == m_adjList.end())
@@ -151,7 +152,7 @@
}
uint32_t
-AdjacencyList::getStatusOfNeighbor(const string& neighbor)
+AdjacencyList::getStatusOfNeighbor(const ndn::Name& neighbor)
{
std::list<Adjacent>::iterator it = find(neighbor);
if (it == m_adjList.end())
@@ -162,7 +163,7 @@
}
void
-AdjacencyList::setStatusOfNeighbor(const string& neighbor, int32_t status)
+AdjacencyList::setStatusOfNeighbor(const ndn::Name& neighbor, int32_t status)
{
std::list<Adjacent>::iterator it = find(neighbor);
if (it != m_adjList.end())
@@ -220,12 +221,12 @@
}
std::list<Adjacent>::iterator
-AdjacencyList::find(std::string adjName)
+AdjacencyList::find(const ndn::Name& adjName)
{
- Adjacent adj(adjName);
std::list<Adjacent>::iterator it = std::find_if(m_adjList.begin(),
m_adjList.end(),
- bind(&Adjacent::compareName, &adj, _1));
+ ndn::bind(&Adjacent::compare,
+ _1, ndn::cref(adjName)));
return it;
}