model: (Re-)Implementing ability to keep PIT records after Interest is getting satisfied

Default behavior remained the same.

As part of this commit, a small extension (and bug fix) in trie data
structure, allowing search with predicates (e.g., used to lookup a
non-empty PIT entry during Lookup on ContentObject header).
diff --git a/utils/trie/trie-with-policy.h b/utils/trie/trie-with-policy.h
index 08cb21c..2d175a0 100644
--- a/utils/trie/trie-with-policy.h
+++ b/utils/trie/trie-with-policy.h
@@ -82,7 +82,7 @@
     iterator foundItem, lastItem;
     bool reachLast;
     boost::tie (foundItem, reachLast, lastItem) = trie_.find (key);
-    
+
     if (!reachLast || lastItem->payload () == PayloadTraits::empty_payload)
       return; // nothing to invalidate
 
@@ -126,13 +126,13 @@
     iterator foundItem, lastItem;
     bool reachLast;
     boost::tie (foundItem, reachLast, lastItem) = trie_.find (key);
-    
+
     if (!reachLast || lastItem->payload () == PayloadTraits::empty_payload)
       return end ();
 
     return lastItem;
   }
-  
+
   /**
    * @brief Find a node that has the longest common prefix with key (FIB/PIT lookup)
    */
@@ -149,6 +149,23 @@
     return foundItem;
   }
 
+  /**
+   * @brief Find a node that has the longest common prefix with key (FIB/PIT lookup)
+   */
+  template<class Predicate>
+  inline iterator
+  longest_prefix_match_if (const FullKey &key, Predicate pred)
+  {
+    iterator foundItem, lastItem;
+    bool reachLast;
+    boost::tie (foundItem, reachLast, lastItem) = trie_.find_if (key, pred);
+    if (foundItem != trie_.end ())
+      {
+        policy_.lookup (s_iterator_to (foundItem));
+      }
+    return foundItem;
+  }
+
   // /**
   //  * @brief Const version of the longest common prefix match
   //  * (semi-const, because there could be update of the policy anyways)
@@ -172,7 +189,7 @@
     // guard in case we don't have anything in the trie
     if (lastItem == trie_.end ())
       return trie_.end ();
-    
+
     if (reachLast)
       {
         if (foundItem == trie_.end ())
@@ -202,7 +219,7 @@
     // guard in case we don't have anything in the trie
     if (lastItem == trie_.end ())
       return trie_.end ();
-    
+
     if (reachLast)
       {
         foundItem = lastItem->find_if (pred); // may or may not find something
@@ -244,7 +261,7 @@
     else
       return &(*item);
   }
-  
+
 private:
   parent_trie      trie_;
   mutable policy_container policy_;