fw: FaceTable::get returns Face* instead of shared_ptr

refs #3205

Change-Id: I1c61493382fe065389266ff3519ab2b265fe4f79
diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index 204aaaa..90feaff 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -125,7 +125,7 @@
     return false;
   }
 
-  shared_ptr<Face> face = this->getFace(mi.lastNexthop);
+  Face* face = this->getFace(mi.lastNexthop);
   if (face == nullptr || !fibEntry.hasNextHop(*face)) {
     NFD_LOG_DEBUG(pitEntry->getInterest() << " last-nexthop-gone");
     return false;
diff --git a/daemon/fw/client-control-strategy.cpp b/daemon/fw/client-control-strategy.cpp
index a73291b..0779cc1 100644
--- a/daemon/fw/client-control-strategy.cpp
+++ b/daemon/fw/client-control-strategy.cpp
@@ -56,7 +56,7 @@
   }
 
   FaceId outFaceId = static_cast<FaceId>(*tag);
-  shared_ptr<Face> outFace = this->getFace(outFaceId);
+  Face* outFace = this->getFace(outFaceId);
   if (outFace == nullptr) {
     // If outFace doesn't exist, it's better to reject the Interest
     // than to use BestRouteStrategy.
diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp
index 4cda948..b2f1332 100644
--- a/daemon/fw/face-table.cpp
+++ b/daemon/fw/face-table.cpp
@@ -44,11 +44,14 @@
 
 }
 
-shared_ptr<Face>
+Face*
 FaceTable::get(FaceId id) const
 {
-  std::map<FaceId, shared_ptr<Face> >::const_iterator i = m_faces.find(id);
-  return (i == m_faces.end()) ? (shared_ptr<Face>()) : (i->second);
+  auto i = m_faces.find(id);
+  if (i == m_faces.end()) {
+    return nullptr;
+  }
+  return i->second.get();
 }
 
 size_t
diff --git a/daemon/fw/face-table.hpp b/daemon/fw/face-table.hpp
index a9186f6..19517b7 100644
--- a/daemon/fw/face-table.hpp
+++ b/daemon/fw/face-table.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Regents of the University of California,
+ * Copyright (c) 2014-2016,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -33,7 +33,7 @@
 
 class Forwarder;
 
-/** \brief container of all Faces
+/** \brief container of all faces
  */
 class FaceTable : noncopyable
 {
@@ -44,16 +44,28 @@
   VIRTUAL_WITH_TESTS
   ~FaceTable();
 
+  /** \brief add a face
+   *
+   *  FaceTable obtains shared ownership of the face.
+   *  The channel or protocol factory that creates the face may retain ownership.
+   */
   VIRTUAL_WITH_TESTS void
   add(shared_ptr<Face> face);
 
-  /// add a special Face with a reserved FaceId
+  /** \brief add a special Face with a reserved FaceId
+   */
   VIRTUAL_WITH_TESTS void
   addReserved(shared_ptr<Face> face, FaceId faceId);
 
-  VIRTUAL_WITH_TESTS shared_ptr<Face>
+  /** \brief get face by FaceId
+   *  \return a face if found, nullptr if not found;
+   *          face->shared_from_this() can be used if shared_ptr<Face> is desired
+   */
+  VIRTUAL_WITH_TESTS Face*
   get(FaceId id) const;
 
+  /** \return count of faces
+   */
   size_t
   size() const;
 
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index bf95d98..3c80419 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -67,7 +67,7 @@
    *
    *  shortcut to .getFaceTable().get(face)
    */
-  shared_ptr<Face>
+  Face*
   getFace(FaceId id) const;
 
   /** \brief add new Face
@@ -260,7 +260,7 @@
   return m_faceTable;
 }
 
-inline shared_ptr<Face>
+inline Face*
 Forwarder::getFace(FaceId id) const
 {
   return m_faceTable.get(id);
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index 386dd7f..bc8c348 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -171,11 +171,11 @@
   MeasurementsAccessor&
   getMeasurements();
 
-  shared_ptr<Face>
-  getFace(FaceId id);
+  Face*
+  getFace(FaceId id) const;
 
   const FaceTable&
-  getFaceTable();
+  getFaceTable() const;
 
 protected: // accessors
   signal::Signal<FaceTable, shared_ptr<Face>>& afterAddFace;
@@ -230,14 +230,14 @@
   return m_measurements;
 }
 
-inline shared_ptr<Face>
-Strategy::getFace(FaceId id)
+inline Face*
+Strategy::getFace(FaceId id) const
 {
   return m_forwarder.getFace(id);
 }
 
 inline const FaceTable&
-Strategy::getFaceTable()
+Strategy::getFaceTable() const
 {
   return m_forwarder.getFaceTable();
 }