table: NameTree::lookup return Entry& instead of shared_ptr
refs #3687
Change-Id: Ie86057337dd36ff2bc6ef3ea0c73fd4ffc4b13d0
diff --git a/daemon/table/measurements.cpp b/daemon/table/measurements.cpp
index b2e8637..60011e2 100644
--- a/daemon/table/measurements.cpp
+++ b/daemon/table/measurements.cpp
@@ -59,25 +59,22 @@
Entry&
Measurements::get(const Name& name)
{
- shared_ptr<name_tree::Entry> nte = m_nameTree.lookup(name);
- BOOST_ASSERT(nte != nullptr);
- return this->get(*nte);
+ name_tree::Entry& nte = m_nameTree.lookup(name);
+ return this->get(nte);
}
Entry&
Measurements::get(const fib::Entry& fibEntry)
{
- shared_ptr<name_tree::Entry> nte = m_nameTree.lookup(fibEntry);
- BOOST_ASSERT(nte != nullptr);
- return this->get(*nte);
+ name_tree::Entry& nte = m_nameTree.lookup(fibEntry);
+ return this->get(nte);
}
Entry&
Measurements::get(const pit::Entry& pitEntry)
{
- shared_ptr<name_tree::Entry> nte = m_nameTree.lookup(pitEntry);
- BOOST_ASSERT(nte != nullptr);
- return this->get(*nte);
+ name_tree::Entry& nte = m_nameTree.lookup(pitEntry);
+ return this->get(nte);
}
Entry*
@@ -87,7 +84,7 @@
return nullptr;
}
- shared_ptr<name_tree::Entry> nteChild = m_nameTree.getEntry(child);
+ name_tree::Entry* nteChild = m_nameTree.getEntry(child);
name_tree::Entry* nte = nteChild->getParent();
BOOST_ASSERT(nte != nullptr);
return &this->get(*nte);
@@ -130,7 +127,7 @@
void
Measurements::extendLifetime(Entry& entry, const time::nanoseconds& lifetime)
{
- shared_ptr<name_tree::Entry> nte = m_nameTree.getEntry(entry);
+ name_tree::Entry* nte = m_nameTree.getEntry(entry);
BOOST_ASSERT(nte != nullptr);
time::steady_clock::TimePoint expiry = time::steady_clock::now() + lifetime;
@@ -147,11 +144,11 @@
void
Measurements::cleanup(Entry& entry)
{
- shared_ptr<name_tree::Entry> nte = m_nameTree.getEntry(entry);
+ name_tree::Entry* nte = m_nameTree.getEntry(entry);
BOOST_ASSERT(nte != nullptr);
nte->setMeasurementsEntry(nullptr);
- m_nameTree.eraseIfEmpty(nte.get());
+ m_nameTree.eraseIfEmpty(nte);
--m_nItems;
}