table: accept predicate in Measurements::findLongestPrefixMatch

This commit also deletes unused Measurements::s_defaultLifetime constant.

refs #2314

Change-Id: I6ffce7dee828f1f9aa47099777df6ee0615ce4f1
diff --git a/daemon/table/measurements.hpp b/daemon/table/measurements.hpp
index 71d8db5..4d19f34 100644
--- a/daemon/table/measurements.hpp
+++ b/daemon/table/measurements.hpp
@@ -33,15 +33,44 @@
 
 namespace fib {
 class Entry;
-}
+} // namespace fib
 
 namespace pit {
 class Entry;
-}
+} // namespace pit
 
+namespace measurements {
 
-/** \class Measurement
- *  \brief represents the Measurements table
+/** \brief a predicate that accepts or rejects a \p Entry
+ */
+typedef std::function<bool(const Entry&)> EntryPredicate;
+
+/** \brief an \p EntryPredicate that accepts any \p Entry
+ */
+class AnyEntry
+{
+public:
+  bool
+  operator()(const Entry& entry)
+  {
+    return true;
+  }
+};
+
+template<typename T>
+class EntryWithStrategyInfo
+{
+public:
+  bool
+  operator()(const Entry& entry)
+  {
+    return entry.getStrategyInfo<T>() != nullptr;
+  }
+};
+
+} // namespace measurements
+
+/** \brief represents the Measurements table
  */
 class Measurements : noncopyable
 {
@@ -73,7 +102,9 @@
   /** \brief perform a longest prefix match
    */
   shared_ptr<measurements::Entry>
-  findLongestPrefixMatch(const Name& name) const;
+  findLongestPrefixMatch(const Name& name,
+                         const measurements::EntryPredicate& pred =
+                             measurements::AnyEntry()) const;
 
   /** \brief perform an exact match
    */
@@ -103,7 +134,6 @@
 private:
   NameTree& m_nameTree;
   size_t m_nItems;
-  static const time::nanoseconds s_defaultLifetime;
 };
 
 inline time::nanoseconds