src: Creating daemon/common.hpp for all generic includes and import of commonly used abstractions to ndn namespace

This commit also update CS interface (find should return
shared_ptr<Data>, CS entry is internal to CS, the design diagrams are
corrected too).

Change-Id: Ib6377b6d9b8478640ac35d3cfb6c9180cc57c4fe
diff --git a/daemon/common.hpp b/daemon/common.hpp
new file mode 100644
index 0000000..05553b6
--- /dev/null
+++ b/daemon/common.hpp
@@ -0,0 +1,30 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NFD_COMMON_HPP
+#define NFD_COMMON_HPP
+
+#include <ndn-cpp-dev/interest.hpp>
+#include <ndn-cpp-dev/data.hpp>
+
+#include <boost/utility.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/function.hpp>
+#include <boost/bind.hpp>
+
+#include <vector>
+
+namespace ndn {
+
+using boost::noncopyable;
+using boost::shared_ptr;
+using boost::make_shared;
+using boost::function;
+using boost::bind;
+
+} // namespace ndn
+
+#endif // NFD_COMMON_HPP
diff --git a/daemon/table/cs-entry.hpp b/daemon/table/cs-entry.hpp
index adb2b8c..1726d87 100644
--- a/daemon/table/cs-entry.hpp
+++ b/daemon/table/cs-entry.hpp
@@ -4,9 +4,11 @@
  * See COPYING for copyright and distribution information.
  */
 
-#ifndef NFD_TABLE_CS_ENTRY_H
-#define NFD_TABLE_CS_ENTRY_H
-#include <boost/utility.hpp>
+#ifndef NFD_TABLE_CS_ENTRY_HPP
+#define NFD_TABLE_CS_ENTRY_HPP
+
+#include "common.hpp"
+
 namespace ndn {
 namespace cs {
 
@@ -14,10 +16,11 @@
  *  \brief represents a CS entry
  */
 
-class Entry : boost::noncopyable
+class Entry : noncopyable
 {
 };
 
-};//namespace cs
-};//namespace ndn
-#endif//NFD_TABLE_CS_ENTRY_H
+} // namespace cs
+} // namespace ndn
+
+#endif // NFD_TABLE_CS_ENTRY_HPP
diff --git a/daemon/table/cs.cpp b/daemon/table/cs.cpp
index fdf5168..d437dbd 100644
--- a/daemon/table/cs.cpp
+++ b/daemon/table/cs.cpp
@@ -7,6 +7,7 @@
 // XXX This is a fake CS that does not cache anything.
 
 #include "cs.hpp"
+
 namespace ndn {
 
 Cs::Cs()
@@ -18,16 +19,16 @@
 }
 
 bool
-Cs::insert(boost::shared_ptr<Data> data)
+Cs::insert(shared_ptr<Data> data)
 {
   return false;
 }
   
-boost::shared_ptr<cs::Entry>
+shared_ptr<Data>
 Cs::find(const Interest& interest)
 {
-  return boost::shared_ptr<cs::Entry>();
+  return shared_ptr<Data>();
 }
 
 
-};//namespace ndn
+} //namespace ndn
diff --git a/daemon/table/cs.hpp b/daemon/table/cs.hpp
index 67283b6..c1c3e37 100644
--- a/daemon/table/cs.hpp
+++ b/daemon/table/cs.hpp
@@ -4,18 +4,18 @@
  * See COPYING for copyright and distribution information.
  */
 
-#ifndef NFD_TABLE_CS_H
-#define NFD_TABLE_CS_H
-#include <boost/shared_ptr.hpp>
-#include <ndn-cpp-dev/interest.hpp>
-#include <ndn-cpp-dev/data.hpp>
+#ifndef NFD_TABLE_CS_HPP
+#define NFD_TABLE_CS_HPP
+
+#include "common.hpp"
 #include "cs-entry.hpp"
+
 namespace ndn {
 
 /** \class Cs
  *  \brief represents the ContentStore
  */
-class Cs : boost::noncopyable
+class Cs : noncopyable
 {
 public:
   Cs();
@@ -30,14 +30,15 @@
    *  \return{ whether the Data is added }
    */
   bool
-  insert(boost::shared_ptr<Data> data);
+  insert(shared_ptr<Data> data);
   
   /** \brief finds the best match Data for an Interest
    *  \return{ the best match, if any; otherwise null }
    */
-  boost::shared_ptr<cs::Entry>
+  shared_ptr<Data>
   find(const Interest& interest);
 };
 
-};//namespace ndn
-#endif//NFD_TABLE_CS_H
+} // namespace ndn
+
+#endif // NFD_TABLE_CS_HPP
diff --git a/daemon/util/event-emitter.hpp b/daemon/util/event-emitter.hpp
index fa7de00..4499eaa 100644
--- a/daemon/util/event-emitter.hpp
+++ b/daemon/util/event-emitter.hpp
@@ -4,11 +4,11 @@
  * See COPYING for copyright and distribution information.
  */
 
-#ifndef NFD_UTIL_EVENT_EMITTER_H
-#define NFD_UTIL_EVENT_EMITTER_H
-#include <vector>
-#include <boost/utility.hpp>
-#include <boost/function.hpp>
+#ifndef NFD_UTIL_EVENT_EMITTER_HPP
+#define NFD_UTIL_EVENT_EMITTER_HPP
+
+#include "common.hpp"
+
 namespace ndn {
 
 struct empty {};
@@ -30,11 +30,11 @@
 // four arguments
 template<typename T1 = empty, typename T2 = empty,
     typename T3 = empty, typename T4 = empty>
-class EventEmitter : boost::noncopyable
+class EventEmitter : noncopyable
 {
 public:
   /// represents a handler that can subscribe to the event
-  typedef boost::function<void(const T1&, const T2&,
+  typedef function<void(const T1&, const T2&,
                                const T3&, const T4&)> Handler;
   
   /// adds an subscription
@@ -61,10 +61,10 @@
 
 // zero argument
 template<>
-class EventEmitter<empty, empty, empty, empty> : boost::noncopyable
+class EventEmitter<empty, empty, empty, empty> : noncopyable
 {
 public:
-  typedef boost::function<void()> Handler;
+  typedef function<void()> Handler;
   
   void
   operator+=(Handler handler);
@@ -85,10 +85,10 @@
 
 // one argument
 template<typename T1>
-class EventEmitter<T1, empty, empty, empty> : boost::noncopyable
+class EventEmitter<T1, empty, empty, empty> : noncopyable
 {
 public:
-  typedef boost::function<void(const T1&)> Handler;
+  typedef function<void(const T1&)> Handler;
   
   void
   operator+=(Handler handler);
@@ -109,10 +109,10 @@
 
 // two arguments
 template<typename T1, typename T2>
-class EventEmitter<T1, T2, empty, empty> : boost::noncopyable
+class EventEmitter<T1, T2, empty, empty> : noncopyable
 {
 public:
-  typedef boost::function<void(const T1&, const T2&)> Handler;
+  typedef function<void(const T1&, const T2&)> Handler;
   
   void
   operator+=(Handler handler);
@@ -133,11 +133,10 @@
 
 // three arguments
 template<typename T1, typename T2, typename T3>
-class EventEmitter<T1, T2, T3, empty> : boost::noncopyable
+class EventEmitter<T1, T2, T3, empty> : noncopyable
 {
 public:
-  typedef boost::function<void(const T1&, const T2&,
-                               const T3&)> Handler;
+  typedef function<void(const T1&, const T2&, const T3&)> Handler;
   
   void
   operator+=(Handler handler);
@@ -321,5 +320,6 @@
 }
 
 
-};//namespace ndn
-#endif//NFD_UTIL_EVENT_EMITTER_H
+} // namespace ndn
+
+#endif // NFD_UTIL_EVENT_EMITTER_HPP