table: Allow iteration over CS entries
Change-Id: I23bf0da9a853de70187c9e72a0f7a5cb98107fbd
Refs: #2340
diff --git a/daemon/table/cs-entry.cpp b/daemon/table/cs-entry.cpp
index 1262065..0bcdefc 100644
--- a/daemon/table/cs-entry.cpp
+++ b/daemon/table/cs-entry.cpp
@@ -35,12 +35,9 @@
NFD_LOG_INIT("CsEntry");
-void
-Entry::release()
+Entry::Entry()
+ : m_isUnsolicited(false)
{
- BOOST_ASSERT(m_layerIterators.empty());
-
- m_dataPacket.reset();
}
void
@@ -58,27 +55,18 @@
m_staleAt = time::steady_clock::now() + m_dataPacket->getFreshnessPeriod();
}
-void
-Entry::setIterator(int layer, const Entry::LayerIterators::mapped_type& layerIterator)
+bool
+Entry::isStale() const
{
- m_layerIterators[layer] = layerIterator;
+ return m_staleAt < time::steady_clock::now();
}
void
-Entry::removeIterator(int layer)
+Entry::reset()
{
- m_layerIterators.erase(layer);
-}
-
-void
-Entry::printIterators() const
-{
- for (LayerIterators::const_iterator it = m_layerIterators.begin();
- it != m_layerIterators.end();
- ++it)
- {
- NFD_LOG_TRACE("[" << it->first << "]" << " " << &(*it->second));
- }
+ m_staleAt = time::steady_clock::TimePoint();
+ m_dataPacket.reset();
+ m_isUnsolicited = false;
}
} // namespace cs