table: make name_tree::Node the sole owner of name_tree::Entry

This commit also improves name_tree::Entry test coverage.

refs #3687

Change-Id: I92375f29fbebab82c67da7dff2ea7a2952ba2cca
diff --git a/daemon/table/name-tree-entry.cpp b/daemon/table/name-tree-entry.cpp
index 77b66ef..5721e22 100644
--- a/daemon/table/name-tree-entry.cpp
+++ b/daemon/table/name-tree-entry.cpp
@@ -72,15 +72,15 @@
 void
 Entry::setFibEntry(unique_ptr<fib::Entry> fibEntry)
 {
-  BOOST_ASSERT(fibEntry == nullptr || fibEntry->m_nameTreeEntry.expired());
+  BOOST_ASSERT(fibEntry == nullptr || fibEntry->m_nameTreeEntry == nullptr);
 
   if (m_fibEntry != nullptr) {
-    m_fibEntry->m_nameTreeEntry.reset();
+    m_fibEntry->m_nameTreeEntry = nullptr;
   }
   m_fibEntry = std::move(fibEntry);
 
   if (m_fibEntry != nullptr) {
-    m_fibEntry->m_nameTreeEntry = this->shared_from_this();
+    m_fibEntry->m_nameTreeEntry = this;
   }
 }
 
@@ -88,53 +88,53 @@
 Entry::insertPitEntry(shared_ptr<pit::Entry> pitEntry)
 {
   BOOST_ASSERT(pitEntry != nullptr);
-  BOOST_ASSERT(pitEntry->m_nameTreeEntry.expired());
+  BOOST_ASSERT(pitEntry->m_nameTreeEntry == nullptr);
 
   m_pitEntries.push_back(pitEntry);
-  pitEntry->m_nameTreeEntry = this->shared_from_this();
+  pitEntry->m_nameTreeEntry = this;
 }
 
 void
 Entry::erasePitEntry(shared_ptr<pit::Entry> pitEntry)
 {
   BOOST_ASSERT(pitEntry != nullptr);
-  BOOST_ASSERT(pitEntry->m_nameTreeEntry.lock().get() == this);
+  BOOST_ASSERT(pitEntry->m_nameTreeEntry == this);
 
   auto it = std::find(m_pitEntries.begin(), m_pitEntries.end(), pitEntry);
   BOOST_ASSERT(it != m_pitEntries.end());
 
   *it = m_pitEntries.back();
   m_pitEntries.pop_back();
-  pitEntry->m_nameTreeEntry.reset();
+  pitEntry->m_nameTreeEntry = nullptr;
 }
 
 void
 Entry::setMeasurementsEntry(unique_ptr<measurements::Entry> measurementsEntry)
 {
-  BOOST_ASSERT(measurementsEntry == nullptr || measurementsEntry->m_nameTreeEntry.expired());
+  BOOST_ASSERT(measurementsEntry == nullptr || measurementsEntry->m_nameTreeEntry == nullptr);
 
   if (m_measurementsEntry != nullptr) {
-    m_measurementsEntry->m_nameTreeEntry.reset();
+    m_measurementsEntry->m_nameTreeEntry = nullptr;
   }
   m_measurementsEntry = std::move(measurementsEntry);
 
   if (m_measurementsEntry != nullptr) {
-    m_measurementsEntry->m_nameTreeEntry = this->shared_from_this();
+    m_measurementsEntry->m_nameTreeEntry = this;
   }
 }
 
 void
 Entry::setStrategyChoiceEntry(unique_ptr<strategy_choice::Entry> strategyChoiceEntry)
 {
-  BOOST_ASSERT(strategyChoiceEntry == nullptr || strategyChoiceEntry->m_nameTreeEntry.expired());
+  BOOST_ASSERT(strategyChoiceEntry == nullptr || strategyChoiceEntry->m_nameTreeEntry == nullptr);
 
   if (m_strategyChoiceEntry != nullptr) {
-    m_strategyChoiceEntry->m_nameTreeEntry.reset();
+    m_strategyChoiceEntry->m_nameTreeEntry = nullptr;
   }
   m_strategyChoiceEntry = std::move(strategyChoiceEntry);
 
   if (m_strategyChoiceEntry != nullptr) {
-    m_strategyChoiceEntry->m_nameTreeEntry = this->shared_from_this();
+    m_strategyChoiceEntry->m_nameTreeEntry = this;
   }
 }