table: reorganize PIT implementation

Merge pit-{face,in,out}-record.{cpp,hpp} into pit-entry.{cpp,hpp}
and merge pit-iterator.{cpp,hpp} into pit.{cpp,hpp}.

Rename get{In,Out}Record() to find{In,Out}Record(), following the
typical C++ pattern of using the verb "find" for functions that
return iterators.

No functional changes.

Change-Id: I6740dd6cfe92ca477938ab8dc2f6271fd8b6cc26
diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index 0070a3e..2c154bc 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -170,7 +170,7 @@
     return;
   }
 
-  auto inRecord = pitEntry->getInRecord(*inFace);
+  auto inRecord = pitEntry->findInRecord(*inFace);
   // in-record is erased only if Interest is satisfied, and RTO timer should have been cancelled
   // note: if this strategy is extended to send Nacks, that would also erase the in-record,
   //       and the RTO timer should be cancelled in that case as well
@@ -218,7 +218,7 @@
     return;
   }
 
-  auto outRecord = pitEntry->getOutRecord(ingress.face);
+  auto outRecord = pitEntry->findOutRecord(ingress.face);
   if (outRecord == pitEntry->out_end()) {
     NFD_LOG_DATA_FROM(data, ingress, "no-out-record");
     return;
diff --git a/daemon/fw/algorithm.cpp b/daemon/fw/algorithm.cpp
index a16ccc3..cdc432b 100644
--- a/daemon/fw/algorithm.cpp
+++ b/daemon/fw/algorithm.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -116,7 +116,7 @@
     if (!isNextHopEligible(inFace, interest, *it, pitEntry))
       continue;
 
-    auto outRecord = pitEntry->getOutRecord(it->getFace());
+    auto outRecord = pitEntry->findOutRecord(it->getFace());
     BOOST_ASSERT(outRecord != pitEntry->out_end());
     if (outRecord->getLastRenewed() < earliestRenewed) {
       found = it;
@@ -142,7 +142,7 @@
 
   if (wantUnused) {
     // nexthop must not have unexpired out-record
-    auto outRecord = pitEntry->getOutRecord(outFace);
+    auto outRecord = pitEntry->findOutRecord(outFace);
     if (outRecord != pitEntry->out_end() && outRecord->getExpiry() > now) {
       return false;
     }
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index 18d1b70..edb6ec1 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -144,7 +144,7 @@
     return;
   }
 
-  auto outRecord = pitEntry->getOutRecord(ingress.face);
+  auto outRecord = pitEntry->findOutRecord(ingress.face);
   if (outRecord == pitEntry->out_end()) {
     NFD_LOG_DATA_FROM(data, ingress, "no-out-record");
   }
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 4aa78e2..993f773 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -453,7 +453,7 @@
   }
 
   // has out-record?
-  auto outRecord = pitEntry->getOutRecord(ingress.face);
+  auto outRecord = pitEntry->findOutRecord(ingress.face);
   // if no out-record found, drop
   if (outRecord == pitEntry->out_end()) {
     NFD_LOG_DEBUG("onIncomingNack in=" << ingress << " nack=" << nack.getInterest().getName()
@@ -495,7 +495,7 @@
   }
 
   // has in-record?
-  auto inRecord = pitEntry->getInRecord(egress);
+  auto inRecord = pitEntry->findInRecord(egress);
 
   // if no in-record found, drop
   if (inRecord == pitEntry->in_end()) {
@@ -585,15 +585,14 @@
   // Dead Nonce List insert
   if (upstream == nullptr) {
     // insert all outgoing Nonces
-    const auto& outRecords = pitEntry.getOutRecords();
-    std::for_each(outRecords.begin(), outRecords.end(), [&] (const auto& outRecord) {
+    std::for_each(pitEntry.out_begin(), pitEntry.out_end(), [&] (const auto& outRecord) {
       m_deadNonceList.add(pitEntry.getName(), outRecord.getLastNonce());
     });
   }
   else {
     // insert outgoing Nonce of a specific face
-    auto outRecord = pitEntry.getOutRecord(*upstream);
-    if (outRecord != pitEntry.getOutRecords().end()) {
+    auto outRecord = pitEntry.findOutRecord(*upstream);
+    if (outRecord != pitEntry.out_end()) {
       m_deadNonceList.add(pitEntry.getName(), outRecord->getLastNonce());
     }
   }
diff --git a/daemon/fw/process-nack-traits.cpp b/daemon/fw/process-nack-traits.cpp
index 25b2526..6919268 100644
--- a/daemon/fw/process-nack-traits.cpp
+++ b/daemon/fw/process-nack-traits.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -55,7 +55,7 @@
 
   if (nOutRecordsNotNacked == 1) {
     BOOST_ASSERT(lastFaceNotNacked != nullptr);
-    auto inR = pitEntry->getInRecord(*lastFaceNotNacked);
+    auto inR = pitEntry->findInRecord(*lastFaceNotNacked);
     if (inR != pitEntry->in_end()) {
       // one out-record not Nacked, which is also a downstream
       NFD_LOG_NACK_FROM(nack, inFace.getId(), "bidirectional nack-to=" << lastFaceNotNacked->getId()
diff --git a/daemon/fw/retx-suppression-exponential.cpp b/daemon/fw/retx-suppression-exponential.cpp
index 39af1f5..8eb5071 100644
--- a/daemon/fw/retx-suppression-exponential.cpp
+++ b/daemon/fw/retx-suppression-exponential.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -99,7 +99,7 @@
 RetxSuppressionExponential::decidePerUpstream(pit::Entry& pitEntry, Face& outFace)
 {
   // NEW if outRecord for the face does not exist
-  auto outRecord = pitEntry.getOutRecord(outFace);
+  auto outRecord = pitEntry.findOutRecord(outFace);
   if (outRecord == pitEntry.out_end()) {
     return RetxSuppressionResult::NEW;
   }
diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp
index 7cb14c4..8b5b9e8 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.cpp
@@ -73,7 +73,7 @@
   const fib::NextHopList& nexthops = fibEntry.getNextHops();
 
   bool isNonDiscovery = interest.getTag<lp::NonDiscoveryTag>() != nullptr;
-  auto inRecordInfo = pitEntry->getInRecord(ingress.face)->insertStrategyInfo<InRecordInfo>().first;
+  auto inRecordInfo = pitEntry->findInRecord(ingress.face)->insertStrategyInfo<InRecordInfo>().first;
   if (isNonDiscovery) { // "non-discovery" Interest
     inRecordInfo->isNonDiscoveryInterest = true;
     if (nexthops.empty()) { // return NACK if no matching FIB entry exists
@@ -103,7 +103,7 @@
 SelfLearningStrategy::afterReceiveData(const Data& data, const FaceEndpoint& ingress,
                                        const shared_ptr<pit::Entry>& pitEntry)
 {
-  auto outRecord = pitEntry->getOutRecord(ingress.face);
+  auto outRecord = pitEntry->findOutRecord(ingress.face);
   if (outRecord == pitEntry->out_end()) {
     NFD_LOG_DATA_FROM(data, ingress, "no-out-record");
     return;
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 712e200..47fd7d9 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -248,7 +248,7 @@
 {
   BOOST_ASSERT(pitEntry->getInterest().matchesData(data));
 
-  auto inRecord = pitEntry->getInRecord(egress);
+  auto inRecord = pitEntry->findInRecord(egress);
   if (inRecord != pitEntry->in_end()) {
     auto pitToken = inRecord->getInterest().getTag<lp::PitToken>();