table: erase NameTree entry when FIB/Measurements/StrategyChoice entry is erased
This commit also optimizes Measurements table to make use of NameTree shortcuts.
refs #1803
Change-Id: Ib0e465750ed5e8ff9ed129a926a7bc852db4e9e1
diff --git a/daemon/table/name-tree.hpp b/daemon/table/name-tree.hpp
index 2f404bf..027f852 100644
--- a/daemon/table/name-tree.hpp
+++ b/daemon/table/name-tree.hpp
@@ -1,11 +1,12 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014 Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology
+ * Copyright (c) 2014, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,9 +21,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-// Name Tree (Name Prefix Hash Table)
+ */
#ifndef NFD_DAEMON_TABLE_NAME_TREE_HPP
#define NFD_DAEMON_TABLE_NAME_TREE_HPP
@@ -121,17 +120,12 @@
shared_ptr<name_tree::Entry>
findExactMatch(const Name& prefix) const;
- shared_ptr<name_tree::Entry>
- findExactMatch(const fib::Entry& fibEntry) const;
-
/**
- * \brief Erase a Name Tree Entry if this entry is empty.
- * \details If a Name Tree Entry contains no Children, no FIB, no PIT, and
- * no Measurements entries, then it can be erased. In addition, its parent entry
- * will also be examined by following the parent pointer until all empty entries
- * are erased.
- * \param entry The pointer to the entry to be erased. The entry pointer should
- * returned by the findExactMatch(), lookup(), or findLongestPrefixMatch() functions.
+ * \brief Delete a Name Tree Entry if this entry is empty.
+ * \param entry The entry to be deleted if empty.
+ * \note This function must be called after a table entry is detached from Name Tree
+ * entry. The function deletes a Name Tree entry if nothing is attached to it and
+ * it has no children, then repeats the same process on its ancestors.
*/
bool
eraseEntryIfEmpty(shared_ptr<name_tree::Entry> entry);
@@ -297,12 +291,6 @@
}
inline shared_ptr<name_tree::Entry>
-NameTree::findExactMatch(const fib::Entry& fibEntry) const
-{
- return fibEntry.m_nameTreeEntry;
-}
-
-inline shared_ptr<name_tree::Entry>
NameTree::get(const fib::Entry& fibEntry) const
{
return fibEntry.m_nameTreeEntry;