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/route/name-prefix-table.cpp b/src/route/name-prefix-table.cpp
index e6a7ccf..f791d0a 100644
--- a/src/route/name-prefix-table.cpp
+++ b/src/route/name-prefix-table.cpp
@@ -5,6 +5,7 @@
 #include "nlsr.hpp"
 #include "name-prefix-table.hpp"
 #include "name-prefix-table-entry.hpp"
+#include "routing-table.hpp"
 
 
 
@@ -13,7 +14,7 @@
 using namespace std;
 
 static bool
-npteCompare(NamePrefixTableEntry& npte, const string& name)
+npteCompare(NamePrefixTableEntry& npte, const ndn::Name& name)
 {
   return npte.getNamePrefix() == name;
 }
@@ -21,7 +22,7 @@
 
 
 void
-NamePrefixTable::addEntry(const string& name, RoutingTableEntry& rte, Nlsr& pnlsr)
+NamePrefixTable::addEntry(const ndn::Name& name, RoutingTableEntry& rte)
 {
   std::list<NamePrefixTableEntry>::iterator it = std::find_if(m_table.begin(),
                                                               m_table.end(), bind(&npteCompare, _1, name));
@@ -34,7 +35,7 @@
     m_table.push_back(newEntry);
     if (rte.getNexthopList().getSize() > 0)
     {
-      pnlsr.getFib().update(pnlsr, name, newEntry.getNexthopList());
+      m_nlsr.getFib().update(name, newEntry.getNexthopList());
     }
   }
   else
@@ -44,77 +45,82 @@
       (*it).addRoutingTableEntry(rte);
       (*it).generateNhlfromRteList();
       (*it).getNexthopList().sort();
-      pnlsr.getFib().update(pnlsr, name, (*it).getNexthopList());
+      m_nlsr.getFib().update(name, (*it).getNexthopList());
     }
     else
     {
       (*it).resetRteListNextHop();
       (*it).getNexthopList().reset();
-      pnlsr.getFib().remove(pnlsr, name);
+      m_nlsr.getFib().remove(name);
     }
   }
 }
 
 void
-NamePrefixTable::removeEntry(const string& name, RoutingTableEntry& rte, Nlsr& pnlsr)
+NamePrefixTable::removeEntry(const ndn::Name& name, RoutingTableEntry& rte)
 {
   std::list<NamePrefixTableEntry>::iterator it = std::find_if(m_table.begin(),
                                                               m_table.end(), bind(&npteCompare, _1, name));
   if (it != m_table.end())
   {
-    string destRouter = rte.getDestination();
+    ndn::Name destRouter = rte.getDestination();
     (*it).removeRoutingTableEntry(rte);
     if (((*it).getRteListSize() == 0) &&
-        (!pnlsr.getLsdb().doesLsaExist(destRouter + "/1", 1)) &&
-        (!pnlsr.getLsdb().doesLsaExist(destRouter + "/2", 2)) &&
-        (!pnlsr.getLsdb().doesLsaExist(destRouter + "/3", 3)))
+        (!m_nlsr.getLsdb().doesLsaExist(destRouter.append("/name"),
+                                        std::string("name"))) &&
+        (!m_nlsr.getLsdb().doesLsaExist(destRouter.append("/adjacency"),
+                                        std::string("adjacency"))) &&
+        (!m_nlsr.getLsdb().doesLsaExist(destRouter.append("/coordinate"),
+                                        std::string("coordinate"))))
     {
       m_table.erase(it);
-      pnlsr.getFib().remove(pnlsr, name);
+      m_nlsr.getFib().remove(name);
     }
     else
     {
       (*it).generateNhlfromRteList();
-      pnlsr.getFib().update(pnlsr, name, (*it).getNexthopList());
+      m_nlsr.getFib().update(name, (*it).getNexthopList());
     }
   }
 }
 
 
 void
-NamePrefixTable::addEntry(const string& name, const string& destRouter, Nlsr& pnlsr)
+NamePrefixTable::addEntry(const ndn::Name& name, const ndn::Name& destRouter)
 {
+  //
   RoutingTableEntry* rteCheck =
-    pnlsr.getRoutingTable().findRoutingTableEntry(destRouter);
+    m_nlsr.getRoutingTable().findRoutingTableEntry(destRouter);
   if (rteCheck != 0)
   {
-    addEntry(name, *(rteCheck) , pnlsr);
+    addEntry(name, *(rteCheck));
   }
   else
   {
     RoutingTableEntry rte(destRouter);
-    addEntry(name, rte, pnlsr);
+    addEntry(name, rte);
   }
 }
 
 void
-NamePrefixTable::removeEntry(const string& name, const string& destRouter, Nlsr& pnlsr)
+NamePrefixTable::removeEntry(const ndn::Name& name, const ndn::Name& destRouter)
 {
+  //
   RoutingTableEntry* rteCheck =
-    pnlsr.getRoutingTable().findRoutingTableEntry(destRouter);
+    m_nlsr.getRoutingTable().findRoutingTableEntry(destRouter);
   if (rteCheck != 0)
   {
-    removeEntry(name, *(rteCheck), pnlsr);
+    removeEntry(name, *(rteCheck));
   }
   else
   {
     RoutingTableEntry rte(destRouter);
-    removeEntry(name, rte, pnlsr);
+    removeEntry(name, rte);
   }
 }
 
 void
-NamePrefixTable::updateWithNewRoute(Nlsr& pnlsr)
+NamePrefixTable::updateWithNewRoute()
 {
   for (std::list<NamePrefixTableEntry>::iterator it = m_table.begin();
        it != m_table.end(); ++it)
@@ -124,15 +130,15 @@
          rteit != rteList.end(); ++rteit)
     {
       RoutingTableEntry* rteCheck =
-        pnlsr.getRoutingTable().findRoutingTableEntry((*rteit).getDestination());
+        m_nlsr.getRoutingTable().findRoutingTableEntry((*rteit).getDestination());
       if (rteCheck != 0)
       {
-        addEntry((*it).getNamePrefix(), *(rteCheck), pnlsr);
+        addEntry((*it).getNamePrefix(), *(rteCheck));
       }
       else
       {
         RoutingTableEntry rte((*rteit).getDestination());
-        addEntry((*it).getNamePrefix(), rte, pnlsr);
+        addEntry((*it).getNamePrefix(), rte);
       }
     }
   }