face: replace EventEmitter usage with Signal

refs #2300

Change-Id: I17d0d65d2c474b17dd9f23f271a6144b0b4fbc07
diff --git a/tests/daemon/face/dummy-face.hpp b/tests/daemon/face/dummy-face.hpp
index ec0adbf..dc9bcc6 100644
--- a/tests/daemon/face/dummy-face.hpp
+++ b/tests/daemon/face/dummy-face.hpp
@@ -52,7 +52,7 @@
   virtual void
   sendInterest(const Interest& interest)
   {
-    this->onSendInterest(interest);
+    this->emitSignal(onSendInterest, interest);
     m_sentInterests.push_back(interest);
     this->afterSend();
   }
@@ -60,7 +60,7 @@
   virtual void
   sendData(const Data& data)
   {
-    this->onSendData(data);
+    this->emitSignal(onSendData, data);
     m_sentDatas.push_back(data);
     this->afterSend();
   }
@@ -68,22 +68,22 @@
   virtual void
   close()
   {
-    this->onFail("close");
+    this->fail("close");
   }
 
   void
   receiveInterest(const Interest& interest)
   {
-    this->onReceiveInterest(interest);
+    this->emitSignal(onReceiveInterest, interest);
   }
 
   void
   receiveData(const Data& data)
   {
-    this->onReceiveData(data);
+    this->emitSignal(onReceiveData, data);
   }
 
-  EventEmitter<> afterSend;
+  signal::Signal<DummyFaceImpl<FaceBase>> afterSend;
 
 public:
   std::vector<Interest> m_sentInterests;
diff --git a/tests/daemon/face/ethernet.cpp b/tests/daemon/face/ethernet.cpp
index ab0181c..50f403a 100644
--- a/tests/daemon/face/ethernet.cpp
+++ b/tests/daemon/face/ethernet.cpp
@@ -121,7 +121,7 @@
   BOOST_CHECK_EQUAL(face->getCounters().getNInBytes(), 0);
   BOOST_CHECK_EQUAL(face->getCounters().getNOutBytes(), 0);
 
-  face->onFail += [] (const std::string& reason) { BOOST_FAIL(reason); };
+  face->onFail.connect([] (const std::string& reason) { BOOST_FAIL(reason); });
 
   shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
   shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
@@ -171,9 +171,10 @@
   std::vector<Interest> recInterests;
   std::vector<Data>     recDatas;
 
-  face->onFail            += [] (const std::string& reason) { BOOST_FAIL(reason); };
-  face->onReceiveInterest += [&recInterests] (const Interest& i) { recInterests.push_back(i); };
-  face->onReceiveData     += [&recDatas]     (const Data& d)     { recDatas.push_back(d);     };
+  face->onFail.connect([] (const std::string& reason) { BOOST_FAIL(reason); });
+  face->onReceiveInterest.connect(
+      [&recInterests] (const Interest& i) { recInterests.push_back(i); });
+  face->onReceiveData.connect([&recDatas] (const Data& d) { recDatas.push_back(d); });
 
   // check that packet data is not accessed if pcap didn't capture anything (caplen == 0)
   static const pcap_pkthdr header1{};
diff --git a/tests/daemon/face/face.cpp b/tests/daemon/face/face.cpp
index 143dfe6..a8f397a 100644
--- a/tests/daemon/face/face.cpp
+++ b/tests/daemon/face/face.cpp
@@ -65,7 +65,7 @@
   FaceFailTestFace()
     : failCount(0)
   {
-    this->onFail += bind(&FaceFailTestFace::failHandler, this, _1);
+    this->onFail.connect(bind(&FaceFailTestFace::failHandler, this, _1));
   }
 
   void
diff --git a/tests/daemon/face/ndnlp.cpp b/tests/daemon/face/ndnlp.cpp
index f5ba8e1..89f72b0 100644
--- a/tests/daemon/face/ndnlp.cpp
+++ b/tests/daemon/face/ndnlp.cpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "face/ndnlp-sequence-generator.hpp"
 #include "face/ndnlp-slicer.hpp"
@@ -156,10 +157,9 @@
   ReassembleFixture()
     : m_slicer(1500)
   {
-    m_partialMessageStore.onReceive +=
-      // push_back in C++11 has 2 overloads, and specific version needs to be selected
-      bind(static_cast<void (std::vector<Block>::*)(const Block&)>(&std::vector<Block>::push_back),
-           &m_received, _1);
+    m_partialMessageStore.onReceive.connect([this] (const Block& block) {
+      m_received.push_back(block);
+    });
   }
 
   Block
diff --git a/tests/daemon/face/tcp.cpp b/tests/daemon/face/tcp.cpp
index 7c8e33b..ec7f54f 100644
--- a/tests/daemon/face/tcp.cpp
+++ b/tests/daemon/face/tcp.cpp
@@ -119,12 +119,9 @@
   {
     BOOST_CHECK(!static_cast<bool>(face1));
     face1 = newFace;
-    face1->onReceiveInterest +=
-      bind(&EndToEndFixture::face1_onReceiveInterest, this, _1);
-    face1->onReceiveData +=
-      bind(&EndToEndFixture::face1_onReceiveData, this, _1);
-    face1->onFail +=
-      bind(&EndToEndFixture::face1_onFail, this);
+    face1->onReceiveInterest.connect(bind(&EndToEndFixture::face1_onReceiveInterest, this, _1));
+    face1->onReceiveData.connect(bind(&EndToEndFixture::face1_onReceiveData, this, _1));
+    face1->onFail.connect(bind(&EndToEndFixture::face1_onFail, this));
 
     limitedIo.afterOp();
   }
@@ -165,12 +162,9 @@
   {
     BOOST_CHECK(!static_cast<bool>(face2));
     face2 = newFace;
-    face2->onReceiveInterest +=
-      bind(&EndToEndFixture::face2_onReceiveInterest, this, _1);
-    face2->onReceiveData +=
-      bind(&EndToEndFixture::face2_onReceiveData, this, _1);
-    face2->onFail +=
-      bind(&EndToEndFixture::face2_onFail, this);
+    face2->onReceiveInterest.connect(bind(&EndToEndFixture::face2_onReceiveInterest, this, _1));
+    face2->onReceiveData.connect(bind(&EndToEndFixture::face2_onReceiveData, this, _1));
+    face2->onFail.connect(bind(&EndToEndFixture::face2_onFail, this));
 
     limitedIo.afterOp();
   }
@@ -492,12 +486,9 @@
   void
   onFaceCreated(const shared_ptr<Face>& face)
   {
-    face->onReceiveInterest +=
-      bind(&SimpleEndToEndFixture::onReceiveInterest, this, _1);
-    face->onReceiveData +=
-      bind(&SimpleEndToEndFixture::onReceiveData, this, _1);
-    face->onFail +=
-      bind(&SimpleEndToEndFixture::onFail, this, face);
+    face->onReceiveInterest.connect(bind(&SimpleEndToEndFixture::onReceiveInterest, this, _1));
+    face->onReceiveData.connect(bind(&SimpleEndToEndFixture::onReceiveData, this, _1));
+    face->onFail.connect(bind(&SimpleEndToEndFixture::onFail, this, face));
 
     if (static_cast<bool>(dynamic_pointer_cast<LocalFace>(face))) {
       static_pointer_cast<LocalFace>(face)->setLocalControlHeaderFeature(
diff --git a/tests/daemon/face/udp.cpp b/tests/daemon/face/udp.cpp
index abab320..24a4bb8 100644
--- a/tests/daemon/face/udp.cpp
+++ b/tests/daemon/face/udp.cpp
@@ -259,12 +259,9 @@
   channel1_onFaceCreatedNoCheck(const shared_ptr<Face>& newFace)
   {
     face1 = newFace;
-    face1->onReceiveInterest +=
-      bind(&EndToEndFixture::face1_onReceiveInterest, this, _1);
-    face1->onReceiveData +=
-      bind(&EndToEndFixture::face1_onReceiveData, this, _1);
-    face1->onFail +=
-      bind(&EndToEndFixture::face1_onFail, this);
+    face1->onReceiveInterest.connect(bind(&EndToEndFixture::face1_onReceiveInterest, this, _1));
+    face1->onReceiveData.connect(bind(&EndToEndFixture::face1_onReceiveData, this, _1));
+    face1->onFail.connect(bind(&EndToEndFixture::face1_onFail, this));
     BOOST_CHECK_MESSAGE(true, "channel 1 face created");
 
     faces.push_back(face1);
@@ -308,12 +305,9 @@
   {
     BOOST_CHECK(!static_cast<bool>(face2));
     face2 = newFace;
-    face2->onReceiveInterest +=
-      bind(&EndToEndFixture::face2_onReceiveInterest, this, _1);
-    face2->onReceiveData +=
-      bind(&EndToEndFixture::face2_onReceiveData, this, _1);
-    face2->onFail +=
-      bind(&EndToEndFixture::face2_onFail, this);
+    face2->onReceiveInterest.connect(bind(&EndToEndFixture::face2_onReceiveInterest, this, _1));
+    face2->onReceiveData.connect(bind(&EndToEndFixture::face2_onReceiveData, this, _1));
+    face2->onFail.connect(bind(&EndToEndFixture::face2_onFail, this));
 
     faces.push_back(face2);
 
diff --git a/tests/daemon/face/unix-stream.cpp b/tests/daemon/face/unix-stream.cpp
index 24154ec..9bbacb3 100644
--- a/tests/daemon/face/unix-stream.cpp
+++ b/tests/daemon/face/unix-stream.cpp
@@ -96,10 +96,8 @@
   {
     BOOST_CHECK(!static_cast<bool>(face1));
     face1 = static_pointer_cast<UnixStreamFace>(newFace);
-    face1->onReceiveInterest +=
-      bind(&EndToEndFixture::face1_onReceiveInterest, this, _1);
-    face1->onReceiveData +=
-      bind(&EndToEndFixture::face1_onReceiveData, this, _1);
+    face1->onReceiveInterest.connect(bind(&EndToEndFixture::face1_onReceiveInterest, this, _1));
+    face1->onReceiveData.connect(bind(&EndToEndFixture::face1_onReceiveData, this, _1));
 
     limitedIo.afterOp();
   }
@@ -199,10 +197,8 @@
                     face1localUri.size() - std::string(CHANNEL_PATH1).size());
 
   face2 = make_shared<UnixStreamFace>(client);
-  face2->onReceiveInterest +=
-    bind(&EndToEndFixture::face2_onReceiveInterest, this, _1);
-  face2->onReceiveData +=
-    bind(&EndToEndFixture::face2_onReceiveData, this, _1);
+  face2->onReceiveInterest.connect(bind(&EndToEndFixture::face2_onReceiveInterest, this, _1));
+  face2->onReceiveData.connect(bind(&EndToEndFixture::face2_onReceiveData, this, _1));
 
   shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
   shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
@@ -282,12 +278,12 @@
 
   // we should still be able to send/receive with the other one
   face1 = faces.back();
-  face1->onReceiveInterest += bind(&EndToEndFixture::face1_onReceiveInterest, this, _1);
-  face1->onReceiveData += bind(&EndToEndFixture::face1_onReceiveData, this, _1);
+  face1->onReceiveInterest.connect(bind(&EndToEndFixture::face1_onReceiveInterest, this, _1));
+  face1->onReceiveData.connect(bind(&EndToEndFixture::face1_onReceiveData, this, _1));
 
   face2 = make_shared<UnixStreamFace>(client2);
-  face2->onReceiveInterest += bind(&EndToEndFixture::face2_onReceiveInterest, this, _1);
-  face2->onReceiveData += bind(&EndToEndFixture::face2_onReceiveData, this, _1);
+  face2->onReceiveInterest.connect(bind(&EndToEndFixture::face2_onReceiveInterest, this, _1));
+  face2->onReceiveData.connect(bind(&EndToEndFixture::face2_onReceiveData, this, _1));
 
   shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
   shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
@@ -336,10 +332,8 @@
   BOOST_REQUIRE(static_cast<bool>(face1));
 
   face2 = make_shared<UnixStreamFace>(client);
-  face2->onReceiveInterest +=
-    bind(&EndToEndFixture::face2_onReceiveInterest, this, _1);
-  face2->onReceiveData +=
-    bind(&EndToEndFixture::face2_onReceiveData, this, _1);
+  face2->onReceiveInterest.connect(bind(&EndToEndFixture::face2_onReceiveInterest, this, _1));
+  face2->onReceiveData.connect(bind(&EndToEndFixture::face2_onReceiveData, this, _1));
 
   shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
   shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
@@ -425,12 +419,9 @@
   void
   onFaceCreated(const shared_ptr<Face>& face)
   {
-    face->onReceiveInterest +=
-      bind(&SimpleEndToEndFixture::onReceiveInterest, this, _1);
-    face->onReceiveData +=
-      bind(&SimpleEndToEndFixture::onReceiveData, this, _1);
-    face->onFail +=
-      bind(&SimpleEndToEndFixture::onFail, this, face);
+    face->onReceiveInterest.connect(bind(&SimpleEndToEndFixture::onReceiveInterest, this, _1));
+    face->onReceiveData.connect(bind(&SimpleEndToEndFixture::onReceiveData, this, _1));
+    face->onFail.connect(bind(&SimpleEndToEndFixture::onFail, this, face));
 
     if (static_cast<bool>(dynamic_pointer_cast<LocalFace>(face))) {
       static_pointer_cast<LocalFace>(face)->setLocalControlHeaderFeature(
diff --git a/tests/daemon/face/websocket.cpp b/tests/daemon/face/websocket.cpp
index fa93b6a..a8c10b5 100644
--- a/tests/daemon/face/websocket.cpp
+++ b/tests/daemon/face/websocket.cpp
@@ -70,12 +70,9 @@
   {
     BOOST_CHECK(!static_cast<bool>(face1));
     face1 = newFace;
-    face1->onReceiveInterest +=
-      bind(&EndToEndFixture::face1_onReceiveInterest, this, _1);
-    face1->onReceiveData +=
-      bind(&EndToEndFixture::face1_onReceiveData, this, _1);
-    face1->onFail +=
-      bind(&EndToEndFixture::face1_onFail, this);
+    face1->onReceiveInterest.connect(bind(&EndToEndFixture::face1_onReceiveInterest, this, _1));
+    face1->onReceiveData.connect(bind(&EndToEndFixture::face1_onReceiveData, this, _1));
+    face1->onFail.connect(bind(&EndToEndFixture::face1_onFail, this));
 
     limitedIo.afterOp();
   }