interest-table: normalize naming of member methods.
Change-Id: I9c82604202741dbcfdc70ffd8ab1fcdfa0a743ae
Refs: #2120
diff --git a/src/interest-table.cpp b/src/interest-table.cpp
index 5b97f0a..efe7fef 100644
--- a/src/interest-table.cpp
+++ b/src/interest-table.cpp
@@ -36,12 +36,12 @@
clear();
}
-bool
+void
InterestTable::insert(shared_ptr<const Interest> interest,
ndn::ConstBufferPtr digest,
bool isKnown/*=false*/)
{
- bool doesExist = erase(digest);
+ erase(digest);
UnsatisfiedInterestPtr request =
make_shared<UnsatisfiedInterest>(interest, digest, isKnown);
@@ -52,29 +52,28 @@
request->expirationEvent =
m_scheduler.scheduleEvent(entryLifetime,
- [=] () { quiteErase(digest); });
+ [=] () { erase(digest); });
m_table.insert(request);
-
- return doesExist;
}
void
-InterestTable::quiteErase(ndn::ConstBufferPtr digest)
-{
- erase(digest);
-}
-
-bool
InterestTable::erase(ndn::ConstBufferPtr digest)
{
InterestContainer::index<hashed>::type::iterator it = m_table.get<hashed>().find(digest);
if (it != m_table.get<hashed>().end()) {
m_scheduler.cancelEvent((*it)->expirationEvent);
m_table.erase(it);
- return true;
}
- return false;
+}
+
+bool
+InterestTable::has(ndn::ConstBufferPtr digest)
+{
+ if (m_table.get<hashed>().find(digest) != m_table.get<hashed>().end())
+ return true;
+ else
+ return false;
}
size_t
diff --git a/src/interest-table.hpp b/src/interest-table.hpp
index d85661c..5292a69 100644
--- a/src/interest-table.hpp
+++ b/src/interest-table.hpp
@@ -67,23 +67,19 @@
* @param interest Interest to insert.
* @param digest The value of the last digest component.
* @param isKnown false if the digest is an unknown digest.
- * @return true if the same interest exists in the table before insertion.
*/
- bool
+ void
insert(shared_ptr<const Interest> interest,
ndn::ConstBufferPtr digest,
bool isKnown = false);
- /**
- * @brief Delete interest by digest (e.g., when it was satisfied)
- *
- * @return true if an interest with the digest exists in the table before deletion
- */
+ /// @brief check if an interest with the digest exists in the table
bool
- erase(ndn::ConstBufferPtr digest);
+ has(ndn::ConstBufferPtr digest);
+ /// @brief Delete interest by digest (e.g., when it was satisfied)
void
- quiteErase(ndn::ConstBufferPtr digest);
+ erase(ndn::ConstBufferPtr digest);
const_iterator
begin() const
diff --git a/src/logic.cpp b/src/logic.cpp
index e0c0501..48d6cfb 100644
--- a/src/logic.cpp
+++ b/src/logic.cpp
@@ -436,7 +436,8 @@
if (!isTimedProcessing) {
_LOG_DEBUG_ID("Let's wait, just wait for a while");
// Do not hurry, some incoming SyncReplies may help us to recognize the digest
- bool doesExist = m_interestTable.insert(interest, digest, true);
+ bool doesExist = m_interestTable.has(digest);
+ m_interestTable.insert(interest, digest, true);
if (doesExist)
// Original comment (not sure): somebody else replied, so restart random-game timer
// YY: Get the same SyncInterest again, refresh the timer