ims: move InMemoryStorage from util/

refs #3940

Change-Id: I4468fe9b65ef6263a62800701eb6b03df28fa274
diff --git a/src/util/in-memory-storage-entry.cpp b/src/ims/in-memory-storage-entry.cpp
similarity index 87%
rename from src/util/in-memory-storage-entry.cpp
rename to src/ims/in-memory-storage-entry.cpp
index c0f5e59..daf12c5 100644
--- a/src/util/in-memory-storage-entry.cpp
+++ b/src/ims/in-memory-storage-entry.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,7 +22,6 @@
 #include "in-memory-storage-entry.hpp"
 
 namespace ndn {
-namespace util {
 
 InMemoryStorageEntry::InMemoryStorageEntry()
   : m_isFresh(true)
@@ -44,7 +43,7 @@
 }
 
 void
-InMemoryStorageEntry::setMarkStaleEventId(unique_ptr<scheduler::ScopedEventId>&& markStaleEventId)
+InMemoryStorageEntry::setMarkStaleEventId(unique_ptr<util::scheduler::ScopedEventId> markStaleEventId)
 {
   m_markStaleEventId = std::move(markStaleEventId);
 }
@@ -55,5 +54,4 @@
   m_isFresh = false;
 }
 
-} // namespace util
 } // namespace ndn
diff --git a/src/util/in-memory-storage-entry.hpp b/src/ims/in-memory-storage-entry.hpp
similarity index 82%
rename from src/util/in-memory-storage-entry.hpp
rename to src/ims/in-memory-storage-entry.hpp
index 6e77b3d..721a90d 100644
--- a/src/util/in-memory-storage-entry.hpp
+++ b/src/ims/in-memory-storage-entry.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -19,23 +19,20 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_UTIL_IN_MEMORY_STORAGE_ENTRY_HPP
-#define NDN_UTIL_IN_MEMORY_STORAGE_ENTRY_HPP
+#ifndef NDN_IMS_IN_MEMORY_STORAGE_ENTRY_HPP
+#define NDN_IMS_IN_MEMORY_STORAGE_ENTRY_HPP
 
-#include "../common.hpp"
-#include "../interest.hpp"
 #include "../data.hpp"
-#include "scheduler-scoped-event-id.hpp"
+#include "../interest.hpp"
+#include "../util/scheduler-scoped-event-id.hpp"
 
 namespace ndn {
-namespace util {
 
- /** @brief Represents an in-memory storage entry
+/** @brief Represents an in-memory storage entry
  */
 class InMemoryStorageEntry : noncopyable
 {
 public:
-
   /** @brief Create an entry
    */
   InMemoryStorageEntry();
@@ -62,7 +59,6 @@
     return m_dataPacket->getFullName();
   }
 
-
   /** @brief Returns the Data packet stored in the in-memory storage entry
    */
   const Data&
@@ -71,7 +67,6 @@
     return *m_dataPacket;
   }
 
-
   /** @brief Changes the content of in-memory storage entry
    *
    *  This method also allows data to satisfy Interest with MustBeFresh
@@ -82,7 +77,7 @@
   /** @brief Set eventId for the markStale event.
    */
   void
-  setMarkStaleEventId(unique_ptr<scheduler::ScopedEventId>&& eventId);
+  setMarkStaleEventId(unique_ptr<util::scheduler::ScopedEventId> eventId);
 
   /** @brief Disable the data from satisfying interest with MustBeFresh
    */
@@ -101,10 +96,9 @@
   shared_ptr<const Data> m_dataPacket;
 
   bool m_isFresh;
-  unique_ptr<scheduler::ScopedEventId> m_markStaleEventId;
+  unique_ptr<util::scheduler::ScopedEventId> m_markStaleEventId;
 };
 
-} // namespace util
 } // namespace ndn
 
-#endif // NDN_UTIL_IN_MEMORY_STORAGE_ENTRY_HPP
+#endif // NDN_IMS_IN_MEMORY_STORAGE_ENTRY_HPP
diff --git a/src/util/in-memory-storage-fifo.cpp b/src/ims/in-memory-storage-fifo.cpp
similarity index 94%
rename from src/util/in-memory-storage-fifo.cpp
rename to src/ims/in-memory-storage-fifo.cpp
index 0899024..df6e173 100644
--- a/src/util/in-memory-storage-fifo.cpp
+++ b/src/ims/in-memory-storage-fifo.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,7 +22,6 @@
 #include "in-memory-storage-fifo.hpp"
 
 namespace ndn {
-namespace util {
 
 InMemoryStorageFifo::InMemoryStorageFifo(size_t limit)
   : InMemoryStorage(limit)
@@ -62,5 +61,4 @@
     m_cleanupIndex.get<byEntity>().erase(it);
 }
 
-} // namespace util
 } // namespace ndn
diff --git a/src/util/in-memory-storage-fifo.hpp b/src/ims/in-memory-storage-fifo.hpp
similarity index 86%
rename from src/util/in-memory-storage-fifo.hpp
rename to src/ims/in-memory-storage-fifo.hpp
index 2bc1880..6991451 100644
--- a/src/util/in-memory-storage-fifo.hpp
+++ b/src/ims/in-memory-storage-fifo.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -19,20 +19,18 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_UTIL_IN_MEMORY_STORAGE_FIFO_HPP
-#define NDN_UTIL_IN_MEMORY_STORAGE_FIFO_HPP
+#ifndef NDN_IMS_IN_MEMORY_STORAGE_FIFO_HPP
+#define NDN_IMS_IN_MEMORY_STORAGE_FIFO_HPP
 
 #include "in-memory-storage.hpp"
 
 #include <boost/multi_index_container.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
 #include <boost/multi_index/hashed_index.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
 
 namespace ndn {
-namespace util {
 
-/** @brief Provides in-memory storage employing FIFO replacement policy, which is first in first
- *  out.
+/** @brief Provides in-memory storage employing First-In-First-Out (FIFO) replacement policy.
  */
 class InMemoryStorageFifo : public InMemoryStorage
 {
@@ -62,7 +60,7 @@
   beforeErase(InMemoryStorageEntry* entry) override;
 
 private:
-  //multi_index_container to implement FIFO
+  // multi_index_container to implement FIFO
   class byArrival;
   class byEntity;
 
@@ -87,7 +85,6 @@
   CleanupIndex m_cleanupIndex;
 };
 
-} // namespace util
 } // namespace ndn
 
-#endif // NDN_UTIL_IN_MEMORY_STORAGE_FIFO_HPP
+#endif // NDN_IMS_IN_MEMORY_STORAGE_FIFO_HPP
diff --git a/src/util/in-memory-storage-lfu.cpp b/src/ims/in-memory-storage-lfu.cpp
similarity index 95%
rename from src/util/in-memory-storage-lfu.cpp
rename to src/ims/in-memory-storage-lfu.cpp
index 0c08f1c..a155f60 100644
--- a/src/util/in-memory-storage-lfu.cpp
+++ b/src/ims/in-memory-storage-lfu.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,7 +22,6 @@
 #include "in-memory-storage-lfu.hpp"
 
 namespace ndn {
-namespace util {
 
 InMemoryStorageLfu::InMemoryStorageLfu(size_t limit)
   : InMemoryStorage(limit)
@@ -72,5 +71,4 @@
   m_cleanupIndex.get<byEntity>().modify(it, &incrementFrequency);
 }
 
-} // namespace util
 } // namespace ndn
diff --git a/src/util/in-memory-storage-lfu.hpp b/src/ims/in-memory-storage-lfu.hpp
similarity index 92%
rename from src/util/in-memory-storage-lfu.hpp
rename to src/ims/in-memory-storage-lfu.hpp
index 8a21d4c..7633cfd 100644
--- a/src/util/in-memory-storage-lfu.hpp
+++ b/src/ims/in-memory-storage-lfu.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -19,19 +19,18 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_UTIL_IN_MEMORY_STORAGE_LFU_HPP
-#define NDN_UTIL_IN_MEMORY_STORAGE_LFU_HPP
+#ifndef NDN_IMS_IN_MEMORY_STORAGE_LFU_HPP
+#define NDN_IMS_IN_MEMORY_STORAGE_LFU_HPP
 
 #include "in-memory-storage.hpp"
 
-#include <boost/multi_index/member.hpp>
 #include <boost/multi_index_container.hpp>
-#include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/hashed_index.hpp>
 #include <boost/multi_index/identity.hpp>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/ordered_index.hpp>
 
 namespace ndn {
-namespace util {
 
 /** @brief Provides an in-memory storage with Least Frequently Used (LFU) replacement policy.
  *  @note The frequency right now is usage count.
@@ -88,7 +87,7 @@
   }
 
 private:
-  //multi_index_container to implement LFU
+  // multi_index_container to implement LFU
   class byFrequency;
   class byEntity;
 
@@ -115,7 +114,6 @@
   CleanupIndex m_cleanupIndex;
 };
 
-} // namespace util
 } // namespace ndn
 
-#endif // NDN_UTIL_IN_MEMORY_STORAGE_LFU_HPP
+#endif // NDN_IMS_IN_MEMORY_STORAGE_LFU_HPP
diff --git a/src/util/in-memory-storage-lru.cpp b/src/ims/in-memory-storage-lru.cpp
similarity index 95%
rename from src/util/in-memory-storage-lru.cpp
rename to src/ims/in-memory-storage-lru.cpp
index 01c8b12..22c463d 100644
--- a/src/util/in-memory-storage-lru.cpp
+++ b/src/ims/in-memory-storage-lru.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,7 +22,6 @@
 #include "in-memory-storage-lru.hpp"
 
 namespace ndn {
-namespace util {
 
 InMemoryStorageLru::InMemoryStorageLru(size_t limit)
   : InMemoryStorage(limit)
@@ -71,5 +70,4 @@
   afterInsert(entry);
 }
 
-} // namespace util
 } // namespace ndn
diff --git a/src/util/in-memory-storage-lru.hpp b/src/ims/in-memory-storage-lru.hpp
similarity index 86%
rename from src/util/in-memory-storage-lru.hpp
rename to src/ims/in-memory-storage-lru.hpp
index 48b79a8..3dd9dfe 100644
--- a/src/util/in-memory-storage-lru.hpp
+++ b/src/ims/in-memory-storage-lru.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -19,22 +19,20 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_UTIL_IN_MEMORY_STORAGE_LRU_HPP
-#define NDN_UTIL_IN_MEMORY_STORAGE_LRU_HPP
+#ifndef NDN_IMS_IN_MEMORY_STORAGE_LRU_HPP
+#define NDN_IMS_IN_MEMORY_STORAGE_LRU_HPP
 
 #include "in-memory-storage.hpp"
 
-#include <boost/multi_index/member.hpp>
 #include <boost/multi_index_container.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
 #include <boost/multi_index/hashed_index.hpp>
 #include <boost/multi_index/identity.hpp>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
 
 namespace ndn {
-namespace util {
 
-/** @brief Provides in-memory storage employing LRU replacement policy, of which the least
- *  recently used entry will be evict first.
+/** @brief Provides in-memory storage employing Least Recently Used (LRU) replacement policy.
  */
 class InMemoryStorageLru : public InMemoryStorage
 {
@@ -70,7 +68,7 @@
   beforeErase(InMemoryStorageEntry* entry) override;
 
 private:
-  //multi_index_container to implement LRU
+  // multi_index_container to implement LRU
   class byUsedTime;
   class byEntity;
 
@@ -95,7 +93,6 @@
   CleanupIndex m_cleanupIndex;
 };
 
-} // namespace util
 } // namespace ndn
 
-#endif // NDN_UTIL_IN_MEMORY_STORAGE_LRU_HPP
+#endif // NDN_IMS_IN_MEMORY_STORAGE_LRU_HPP
diff --git a/src/util/in-memory-storage-persistent.cpp b/src/ims/in-memory-storage-persistent.cpp
similarity index 92%
rename from src/util/in-memory-storage-persistent.cpp
rename to src/ims/in-memory-storage-persistent.cpp
index 954e9c1..ff6a3a9 100644
--- a/src/util/in-memory-storage-persistent.cpp
+++ b/src/ims/in-memory-storage-persistent.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,7 +22,6 @@
 #include "in-memory-storage-persistent.hpp"
 
 namespace ndn {
-namespace util {
 
 InMemoryStoragePersistent::InMemoryStoragePersistent()
   : InMemoryStorage()
@@ -40,5 +39,4 @@
   return false;
 }
 
-} // namespace util
 } // namespace ndn
diff --git a/src/util/in-memory-storage-persistent.hpp b/src/ims/in-memory-storage-persistent.hpp
similarity index 81%
rename from src/util/in-memory-storage-persistent.hpp
rename to src/ims/in-memory-storage-persistent.hpp
index 7e1a977..5920ef3 100644
--- a/src/util/in-memory-storage-persistent.hpp
+++ b/src/ims/in-memory-storage-persistent.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -19,16 +19,15 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_UTIL_IN_MEMORY_STORAGE_PERSISTENT_HPP
-#define NDN_UTIL_IN_MEMORY_STORAGE_PERSISTENT_HPP
+#ifndef NDN_IMS_IN_MEMORY_STORAGE_PERSISTENT_HPP
+#define NDN_IMS_IN_MEMORY_STORAGE_PERSISTENT_HPP
 
 #include "in-memory-storage.hpp"
 
 namespace ndn {
-namespace util {
 
 /** @brief Provides application cache with persistent storage, of which no replacement policy will
- *  be employed. Entries will only be deleted by explicitly application control.
+ *  be employed. Entries will only be deleted by explicit application control.
  */
 class InMemoryStoragePersistent : public InMemoryStorage
 {
@@ -49,7 +48,6 @@
   evictItem() override;
 };
 
-} // namespace util
 } // namespace ndn
 
-#endif // NDN_UTIL_IN_MEMORY_STORAGE_PERSISTENT_HPP
+#endif // NDN_IMS_IN_MEMORY_STORAGE_PERSISTENT_HPP
diff --git a/src/util/in-memory-storage.cpp b/src/ims/in-memory-storage.cpp
similarity index 98%
rename from src/util/in-memory-storage.cpp
rename to src/ims/in-memory-storage.cpp
index bc1beac..0dc7df7 100644
--- a/src/util/in-memory-storage.cpp
+++ b/src/ims/in-memory-storage.cpp
@@ -22,10 +22,7 @@
 #include "in-memory-storage.hpp"
 #include "in-memory-storage-entry.hpp"
 
-#include "../security/signature-sha256-with-rsa.hpp"
-
 namespace ndn {
-namespace util {
 
 const time::milliseconds InMemoryStorage::INFINITE_WINDOW(-1);
 const time::milliseconds InMemoryStorage::ZERO_WINDOW(0);
@@ -189,7 +186,7 @@
   m_nPackets++;
   entry->setData(data);
   if (m_scheduler != nullptr && mustBeFreshProcessingWindow > ZERO_WINDOW) {
-    auto eventId = make_unique<scheduler::ScopedEventId>(*m_scheduler);
+    auto eventId = make_unique<util::scheduler::ScopedEventId>(*m_scheduler);
     *eventId = m_scheduler->scheduleEvent(mustBeFreshProcessingWindow,
                                           bind(&InMemoryStorageEntry::markStale, entry));
     entry->setMarkStaleEventId(std::move(eventId));
@@ -449,5 +446,4 @@
     os << (*it)->getFullName() << std::endl;
 }
 
-} // namespace util
 } // namespace ndn
diff --git a/src/util/in-memory-storage.hpp b/src/ims/in-memory-storage.hpp
similarity index 96%
rename from src/util/in-memory-storage.hpp
rename to src/ims/in-memory-storage.hpp
index 0b6e523..9e61e7a 100644
--- a/src/util/in-memory-storage.hpp
+++ b/src/ims/in-memory-storage.hpp
@@ -19,34 +19,29 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_UTIL_IN_MEMORY_STORAGE_HPP
-#define NDN_UTIL_IN_MEMORY_STORAGE_HPP
+#ifndef NDN_IMS_IN_MEMORY_STORAGE_HPP
+#define NDN_IMS_IN_MEMORY_STORAGE_HPP
 
-#include "../common.hpp"
-#include "../interest.hpp"
-#include "../data.hpp"
-#include "scheduler.hpp"
 #include "in-memory-storage-entry.hpp"
 
-#include <boost/multi_index/member.hpp>
+#include <iterator>
+#include <stack>
+
 #include <boost/multi_index_container.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
 #include <boost/multi_index/identity.hpp>
 #include <boost/multi_index/mem_fun.hpp>
-
-#include <stack>
-#include <iterator>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
 
 namespace ndn {
-namespace util {
 
 /** @brief Represents in-memory storage
  */
 class InMemoryStorage : noncopyable
 {
 public:
-  //multi_index_container to implement storage
+  // multi_index_container to implement storage
   class byFullName;
 
   typedef boost::multi_index_container<
@@ -341,7 +336,6 @@
   unique_ptr<Scheduler> m_scheduler;
 };
 
-} // namespace util
 } // namespace ndn
 
-#endif // NDN_UTIL_IN_MEMORY_STORAGE_HPP
+#endif // NDN_IMS_IN_MEMORY_STORAGE_HPP
diff --git a/src/mgmt/dispatcher.hpp b/src/mgmt/dispatcher.hpp
index b3c9967..2de6f78 100644
--- a/src/mgmt/dispatcher.hpp
+++ b/src/mgmt/dispatcher.hpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -23,9 +23,9 @@
 #define NDN_MGMT_DISPATCHER_HPP
 
 #include "../face.hpp"
-#include "../security/key-chain.hpp"
 #include "../encoding/block.hpp"
-#include "../util/in-memory-storage-fifo.hpp"
+#include "../security/key-chain.hpp"
+#include "../ims/in-memory-storage-fifo.hpp"
 #include "control-response.hpp"
 #include "control-parameters.hpp"
 #include "status-dataset-context.hpp"
@@ -473,7 +473,7 @@
   std::unordered_map<Name, uint64_t> m_streams;
 
 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
-  util::InMemoryStorageFifo m_storage;
+  InMemoryStorageFifo m_storage;
 };
 
 template<typename CP>