table: MeasurementsAccessor for strategy

refs #1276

Change-Id: Idec8f615c726f51612236a55a7532fabeb81a32d
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 6ab6fd4..8f6f015 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -17,6 +17,7 @@
 Forwarder::Forwarder(boost::asio::io_service& ioService)
   : m_scheduler(ioService)
   , m_lastFaceId(0)
+  , m_measurements(ioService)
 {
   m_strategy = make_shared<fw::BestRouteStrategy>(boost::ref(*this));
 }
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index ae9fb6a..6da99c7 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -13,6 +13,7 @@
 #include "table/fib.hpp"
 #include "table/pit.hpp"
 #include "table/cs.hpp"
+#include "table/measurements.hpp"
 #include "strategy.hpp"
 
 namespace nfd {
@@ -49,6 +50,9 @@
   
   Cs&
   getCs();
+  
+  Measurements&
+  getMeasurements();
 
   shared_ptr<Face>
   getFace(FaceId id);
@@ -117,9 +121,10 @@
   FaceId m_lastFaceId;
   std::map<FaceId, shared_ptr<Face> > m_faces;
   
-  Fib m_fib;
-  Pit m_pit;
-  Cs  m_cs;
+  Fib          m_fib;
+  Pit          m_pit;
+  Cs           m_cs;
+  Measurements m_measurements;
   /// the active strategy (only one strategy in mock)
   shared_ptr<fw::Strategy> m_strategy;
   
@@ -147,6 +152,12 @@
   return m_cs;
 }
 
+inline Measurements&
+Forwarder::getMeasurements()
+{
+  return m_measurements;
+}
+
 } // namespace nfd
 
 #endif // NFD_FW_FORWARDER_HPP
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 14e4cbe..078ef22 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -15,6 +15,7 @@
 
 Strategy::Strategy(Forwarder& forwarder)
   : m_forwarder(forwarder)
+  , m_measurements(m_forwarder.getMeasurements(), m_forwarder.getFib(), this)
 {
 }
 
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index 1ecbfc9..311af93 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -8,16 +8,13 @@
 #define NFD_FW_STRATEGY_HPP
 
 #include "face/face.hpp"
+#include "table/fib-entry.hpp"
+#include "table/pit-entry.hpp"
+#include "table/measurements-accessor.hpp"
 
 namespace nfd {
 
 class Forwarder;
-namespace fib {
-class Entry;
-}
-namespace pit {
-class Entry;
-}
 
 namespace fw {
 
@@ -29,10 +26,10 @@
 public:
   explicit
   Strategy(Forwarder& forwarder);
-  
+
   virtual
   ~Strategy();
-  
+
 public: // triggers
   /** \brief trigger after Interest is received
    *
@@ -53,7 +50,7 @@
                        const Interest& interest,
                        shared_ptr<fib::Entry> fibEntry,
                        shared_ptr<pit::Entry> pitEntry) =0;
-  
+
   /** \brief trigger before PIT entry is satisfied
    *
    *  In this base class this method does nothing.
@@ -61,7 +58,7 @@
   virtual void
   beforeSatisfyPendingInterest(shared_ptr<pit::Entry> pitEntry,
                                const Face& inFace, const Data& data);
-  
+
   /** \brief trigger before PIT entry expires
    *
    *  PIT entry expires when InterestLifetime has elapsed for all InRecords,
@@ -73,7 +70,7 @@
    */
   virtual void
   beforeExpirePendingInterest(shared_ptr<pit::Entry> pitEntry);
-  
+
 //  /** \brief trigger after FIB entry is being inserted
 //   *         and becomes managed by this strategy
 //   *
@@ -81,14 +78,14 @@
 //   */
 //  virtual void
 //  afterAddFibEntry(shared_ptr<fib::Entry> fibEntry);
-//  
+//
 //  /** \brief trigger after FIB entry being managed by this strategy is updated
 //   *
 //   *  In this base class this method does nothing.
 //   */
 //  virtual void
 //  afterUpdateFibEntry(shared_ptr<fib::Entry> fibEntry);
-//  
+//
 //  /** \brief trigger before FIB entry ceises to be managed by this strategy
 //   *         or is being deleted
 //   *
@@ -96,13 +93,13 @@
 //   */
 //  virtual void
 //  beforeRemoveFibEntry(shared_ptr<fib::Entry> fibEntry);
-  
+
 protected: // actions
   /// send Interest to outFace
   VIRTUAL_WITH_TESTS void
   sendInterest(shared_ptr<pit::Entry> pitEntry,
                     shared_ptr<Face> outFace);
-  
+
   /** \brief decide that a pending Interest cannot be forwarded
    *
    *  This shall not be called if the pending Interest has been
@@ -110,15 +107,27 @@
    */
   VIRTUAL_WITH_TESTS void
   rebuffPendingInterest(shared_ptr<pit::Entry> pitEntry);
-  
+
+protected: // accessors
+  MeasurementsAccessor&
+  getMeasurements();
+
 private:
   /** \brief reference to the forwarder
    *
    *  Triggers can access forwarder indirectly via actions.
    */
   Forwarder& m_forwarder;
+
+  MeasurementsAccessor m_measurements;
 };
 
+inline MeasurementsAccessor&
+Strategy::getMeasurements()
+{
+  return m_measurements;
+}
+
 } // namespace fw
 } // namespace nfd