management+util: add 'override' specifier where applicable

Change-Id: Iafb9c2c59026e4268522120f405585ba35fac248
diff --git a/src/util/command-interest-validator.hpp b/src/util/command-interest-validator.hpp
index 689b450..b7c3494 100644
--- a/src/util/command-interest-validator.hpp
+++ b/src/util/command-interest-validator.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -60,11 +60,6 @@
   {
   }
 
-  virtual
-  ~CommandInterestValidator()
-  {
-  }
-
   /**
    * @brief add an Interest rule that allows a specific certificate
    *
@@ -105,7 +100,7 @@
               int stepCount,
               const OnDataValidated& onValidated,
               const OnDataValidationFailed& onValidationFailed,
-              std::vector<shared_ptr<ValidationRequest> >& nextSteps)
+              std::vector<shared_ptr<ValidationRequest>>& nextSteps) override
   {
     onValidationFailed(data.shared_from_this(), "No policy for data checking");
   }
@@ -115,7 +110,8 @@
               int stepCount,
               const OnInterestValidated& onValidated,
               const OnInterestValidationFailed& onValidationFailed,
-              std::vector<shared_ptr<ValidationRequest> >& nextSteps);
+              std::vector<shared_ptr<ValidationRequest>>& nextSteps) override;
+
 private:
   time::milliseconds m_graceInterval; //ms
   std::map<Name, PublicKey> m_trustAnchorsForInterest;
@@ -163,7 +159,7 @@
                                       int stepCount,
                                       const OnInterestValidated& onValidated,
                                       const OnInterestValidationFailed& onValidationFailed,
-                                      std::vector<shared_ptr<ValidationRequest> >& nextSteps)
+                                      std::vector<shared_ptr<ValidationRequest>>& nextSteps)
 {
   const Name& interestName = interest.getName();
 
@@ -255,17 +251,17 @@
           timestampIt->second = interestTime;
         }
     }
-  catch (Signature::Error& e)
+  catch (const Signature::Error&)
     {
       return onValidationFailed(interest.shared_from_this(),
                                 "No valid signature");
     }
-  catch (IdentityCertificate::Error& e)
+  catch (const IdentityCertificate::Error&)
     {
       return onValidationFailed(interest.shared_from_this(),
                                 "Cannot locate the signing key");
     }
-  catch (tlv::Error& e)
+  catch (const tlv::Error&)
     {
       return onValidationFailed(interest.shared_from_this(),
                                 "Cannot decode signature related TLVs");
diff --git a/src/util/dummy-client-face.cpp b/src/util/dummy-client-face.cpp
index bdc8764..13327c6 100644
--- a/src/util/dummy-client-face.cpp
+++ b/src/util/dummy-client-face.cpp
@@ -35,37 +35,37 @@
 {
 public:
   void
-  receive(Block block)
+  receive(Block block) const
   {
     block.encode();
-    if (static_cast<bool>(m_receiveCallback)) {
+    if (m_receiveCallback) {
       m_receiveCallback(block);
     }
   }
 
   virtual void
-  close()
+  close() override
   {
   }
 
   virtual void
-  pause()
+  pause() override
   {
   }
 
   virtual void
-  resume()
+  resume() override
   {
   }
 
   virtual void
-  send(const Block& wire)
+  send(const Block& wire) override
   {
     onSendBlock(wire);
   }
 
   virtual void
-  send(const Block& header, const Block& payload)
+  send(const Block& header, const Block& payload) override
   {
     EncodingBuffer encoder(header.size() + payload.size(), header.size() + payload.size());
     encoder.appendByteArray(header.wire(), header.size());
diff --git a/src/util/face-uri.cpp b/src/util/face-uri.cpp
index f23ae8c..4ad9dba 100644
--- a/src/util/face-uri.cpp
+++ b/src/util/face-uri.cpp
@@ -1,12 +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,
- *                      The University of Memphis
+ * Copyright (c) 2015-2016, 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 ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -212,9 +212,7 @@
 {
 public:
   virtual
-  ~CanonizeProvider()
-  {
-  }
+  ~CanonizeProvider() = default;
 
   virtual std::set<std::string>
   getSchemes() const = 0;
@@ -234,7 +232,7 @@
 {
 public:
   virtual std::set<std::string>
-  getSchemes() const
+  getSchemes() const override
   {
     std::set<std::string> schemes;
     schemes.insert(m_baseScheme);
@@ -244,7 +242,7 @@
   }
 
   virtual bool
-  isCanonical(const FaceUri& faceUri) const
+  isCanonical(const FaceUri& faceUri) const override
   {
     if (faceUri.getPort().empty()) {
       return false;
@@ -272,7 +270,7 @@
   canonize(const FaceUri& faceUri,
            const FaceUri::CanonizeSuccessCallback& onSuccess,
            const FaceUri::CanonizeFailureCallback& onFailure,
-           boost::asio::io_service& io, const time::nanoseconds& timeout) const
+           boost::asio::io_service& io, const time::nanoseconds& timeout) const override
   {
     if (this->isCanonical(faceUri)) {
       onSuccess(faceUri);
@@ -300,6 +298,7 @@
   }
 
 protected:
+  explicit
   IpHostCanonizeProvider(const std::string& baseScheme,
                          uint32_t defaultUnicastPort = 6363,
                          uint32_t defaultMulticastPort = 56363)
@@ -359,7 +358,7 @@
   virtual std::pair<bool, std::string>
   checkAddress(const dns::IpAddress& ipAddress) const
   {
-    return std::make_pair(true, "");
+    return {true, ""};
   }
 
 private:
@@ -387,7 +386,6 @@
 class TcpCanonizeProvider : public IpHostCanonizeProvider<boost::asio::ip::tcp>
 {
 public:
-public:
   TcpCanonizeProvider()
     : IpHostCanonizeProvider("tcp")
   {
@@ -395,12 +393,12 @@
 
 protected:
   virtual std::pair<bool, std::string>
-  checkAddress(const dns::IpAddress& ipAddress) const
+  checkAddress(const dns::IpAddress& ipAddress) const override
   {
     if (ipAddress.is_multicast()) {
-      return std::make_pair(false, "cannot use multicast address");
+      return {false, "cannot use multicast address"};
     }
-    return std::make_pair(true, "");
+    return {true, ""};
   }
 };
 
@@ -408,7 +406,7 @@
 {
 public:
   virtual std::set<std::string>
-  getSchemes() const
+  getSchemes() const override
   {
     std::set<std::string> schemes;
     schemes.insert("ether");
@@ -416,7 +414,7 @@
   }
 
   virtual bool
-  isCanonical(const FaceUri& faceUri) const
+  isCanonical(const FaceUri& faceUri) const override
   {
     if (!faceUri.getPort().empty()) {
       return false;
@@ -433,7 +431,7 @@
   canonize(const FaceUri& faceUri,
            const FaceUri::CanonizeSuccessCallback& onSuccess,
            const FaceUri::CanonizeFailureCallback& onFailure,
-           boost::asio::io_service& io, const time::nanoseconds& timeout) const
+           boost::asio::io_service& io, const time::nanoseconds& timeout) const override
   {
     ethernet::Address addr = ethernet::Address::fromString(faceUri.getHost());
     if (addr.isNull()) {
@@ -490,9 +488,9 @@
     BOOST_ASSERT(!providerTable.empty());
   }
 
-  CanonizeProviderTable::const_iterator it = providerTable.find(scheme);
+  auto it = providerTable.find(scheme);
   if (it == providerTable.end()) {
-    return 0;
+    return nullptr;
   }
   return it->second.get();
 }
@@ -514,30 +512,25 @@
   return cp->isCanonical(*this);
 }
 
-static inline void
-nop()
-{
-}
-
 void
 FaceUri::canonize(const CanonizeSuccessCallback& onSuccess,
                   const CanonizeFailureCallback& onFailure,
                   boost::asio::io_service& io, const time::nanoseconds& timeout) const
 {
   const CanonizeProvider* cp = getCanonizeProvider(this->getScheme());
-  if (cp == 0) {
-    if (static_cast<bool>(onFailure)) {
+  if (cp == nullptr) {
+    if (onFailure) {
       onFailure("scheme not supported");
     }
     return;
   }
 
-  static CanonizeSuccessCallback successNop = bind(&nop);
-  static CanonizeFailureCallback failureNop = bind(&nop);
+  static CanonizeSuccessCallback successNop = bind([]{});
+  static CanonizeFailureCallback failureNop = bind([]{});
 
   cp->canonize(*this,
-               static_cast<bool>(onSuccess) ? onSuccess : successNop,
-               static_cast<bool>(onFailure) ? onFailure : failureNop,
+               onSuccess ? onSuccess : successNop,
+               onFailure ? onFailure : failureNop,
                io, timeout);
 }
 
diff --git a/src/util/in-memory-storage-fifo.cpp b/src/util/in-memory-storage-fifo.cpp
index 5906d97..0899024 100644
--- a/src/util/in-memory-storage-fifo.cpp
+++ b/src/util/in-memory-storage-fifo.cpp
@@ -34,10 +34,6 @@
 {
 }
 
-InMemoryStorageFifo::~InMemoryStorageFifo()
-{
-}
-
 void
 InMemoryStorageFifo::afterInsert(InMemoryStorageEntry* entry)
 {
diff --git a/src/util/in-memory-storage-fifo.hpp b/src/util/in-memory-storage-fifo.hpp
index 4d522a4..3710284 100644
--- a/src/util/in-memory-storage-fifo.hpp
+++ b/src/util/in-memory-storage-fifo.hpp
@@ -43,26 +43,23 @@
   explicit
   InMemoryStorageFifo(boost::asio::io_service& ioService, size_t limit = 10);
 
-  virtual
-  ~InMemoryStorageFifo();
-
 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
   /** @brief Removes one Data packet from in-memory storage based on FIFO
    *  @return{ whether the Data was removed }
    */
   virtual bool
-  evictItem();
+  evictItem() override;
 
   /** @brief Update the entry after a entry is successfully inserted, add it to the cleanupIndex
    */
   virtual void
-  afterInsert(InMemoryStorageEntry* entry);
+  afterInsert(InMemoryStorageEntry* entry) override;
 
   /** @brief Update the entry or other data structures before a entry is successfully erased,
    *  erase it from the cleanupIndex
    */
   virtual void
-  beforeErase(InMemoryStorageEntry* entry);
+  beforeErase(InMemoryStorageEntry* entry) override;
 
 private:
   //multi_index_container to implement FIFO
diff --git a/src/util/in-memory-storage-lfu.cpp b/src/util/in-memory-storage-lfu.cpp
index 0450c6c..0c08f1c 100644
--- a/src/util/in-memory-storage-lfu.cpp
+++ b/src/util/in-memory-storage-lfu.cpp
@@ -34,10 +34,6 @@
 {
 }
 
-InMemoryStorageLfu::~InMemoryStorageLfu()
-{
-}
-
 void
 InMemoryStorageLfu::afterInsert(InMemoryStorageEntry* entry)
 {
diff --git a/src/util/in-memory-storage-lfu.hpp b/src/util/in-memory-storage-lfu.hpp
index f02079e..d866a29 100644
--- a/src/util/in-memory-storage-lfu.hpp
+++ b/src/util/in-memory-storage-lfu.hpp
@@ -46,40 +46,37 @@
   explicit
   InMemoryStorageLfu(boost::asio::io_service& ioService, size_t limit = 10);
 
-  virtual
-  ~InMemoryStorageLfu();
-
 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
   /** @brief Removes one Data packet from in-memory storage based on LFU, i.e. evict the least
    *  frequently accessed Data packet
    *  @return{ whether the Data was removed }
    */
   virtual bool
-  evictItem();
+  evictItem() override;
 
   /** @brief Update the entry when the entry is returned by the find() function,
    *  increment the frequency according to LFU
    */
   virtual void
-  afterAccess(InMemoryStorageEntry* entry);
+  afterAccess(InMemoryStorageEntry* entry) override;
 
   /** @brief Update the entry after a entry is successfully inserted, add it to the cleanupIndex
    */
   virtual void
-  afterInsert(InMemoryStorageEntry* entry);
+  afterInsert(InMemoryStorageEntry* entry) override;
 
   /** @brief Update the entry or other data structures before a entry is successfully erased,
    *  erase it from the cleanupIndex
    */
   virtual void
-  beforeErase(InMemoryStorageEntry* entry);
+  beforeErase(InMemoryStorageEntry* entry) override;
 
 private:
-  //binds frequency and entry together
+  // binds frequency and entry together
   struct CleanupEntry
   {
     InMemoryStorageEntry* entry;
-    uint64_t frequency;//could potentially be overflowed
+    uint64_t frequency; // could potentially be overflowed
   };
 
   /** @brief Function to increment frequency of the entry in the CleanupEntry
diff --git a/src/util/in-memory-storage-lru.cpp b/src/util/in-memory-storage-lru.cpp
index 2a50644..01c8b12 100644
--- a/src/util/in-memory-storage-lru.cpp
+++ b/src/util/in-memory-storage-lru.cpp
@@ -35,10 +35,6 @@
 {
 }
 
-InMemoryStorageLru::~InMemoryStorageLru()
-{
-}
-
 void
 InMemoryStorageLru::afterInsert(InMemoryStorageEntry* entry)
 {
diff --git a/src/util/in-memory-storage-lru.hpp b/src/util/in-memory-storage-lru.hpp
index 8d7f852..4787398 100644
--- a/src/util/in-memory-storage-lru.hpp
+++ b/src/util/in-memory-storage-lru.hpp
@@ -44,33 +44,30 @@
 
   InMemoryStorageLru(boost::asio::io_service& ioService, size_t limit = 10);
 
-  virtual
-  ~InMemoryStorageLru();
-
 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
   /** @brief Removes one Data packet from in-memory storage based on LRU, i.e. evict the least
    *  recently accessed Data packet
    *  @return{ whether the Data was removed }
    */
   virtual bool
-  evictItem();
+  evictItem() override;
 
   /** @brief Update the entry when the entry is returned by the find() function,
    *  update the last used time according to LRU
    */
   virtual void
-  afterAccess(InMemoryStorageEntry* entry);
+  afterAccess(InMemoryStorageEntry* entry) override;
 
   /** @brief Update the entry after a entry is successfully inserted, add it to the cleanupIndex
    */
   virtual void
-  afterInsert(InMemoryStorageEntry* entry);
+  afterInsert(InMemoryStorageEntry* entry) override;
 
   /** @brief Update the entry or other data structures before a entry is successfully erased,
    *  erase it from the cleanupIndex
    */
   virtual void
-  beforeErase(InMemoryStorageEntry* entry);
+  beforeErase(InMemoryStorageEntry* entry) override;
 
 private:
   //multi_index_container to implement LRU
diff --git a/src/util/in-memory-storage-persistent.cpp b/src/util/in-memory-storage-persistent.cpp
index 613aa7b..954e9c1 100644
--- a/src/util/in-memory-storage-persistent.cpp
+++ b/src/util/in-memory-storage-persistent.cpp
@@ -34,10 +34,6 @@
 {
 }
 
-InMemoryStoragePersistent::~InMemoryStoragePersistent()
-{
-}
-
 bool
 InMemoryStoragePersistent::evictItem()
 {
diff --git a/src/util/in-memory-storage-persistent.hpp b/src/util/in-memory-storage-persistent.hpp
index 3cd12ef..3265f52 100644
--- a/src/util/in-memory-storage-persistent.hpp
+++ b/src/util/in-memory-storage-persistent.hpp
@@ -38,9 +38,6 @@
   explicit
   InMemoryStoragePersistent(boost::asio::io_service& ioService);
 
-  virtual
-  ~InMemoryStoragePersistent();
-
 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
   /** @brief Do nothing.
    *
@@ -49,7 +46,7 @@
    *  @return false
    */
   virtual bool
-  evictItem();
+  evictItem() override;
 };
 
 } // namespace util
diff --git a/src/util/indented-stream.hpp b/src/util/indented-stream.hpp
index 0ab76a2..31e5839 100644
--- a/src/util/indented-stream.hpp
+++ b/src/util/indented-stream.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -56,7 +56,8 @@
 public:
   IndentedStream(std::ostream& os, const std::string& indent);
 
-  ~IndentedStream();
+  virtual
+  ~IndentedStream() override;
 
 private:
   // Write a stream buffer that prefixes each line
@@ -66,7 +67,7 @@
     StreamBuf(std::ostream& os, const std::string& indent);
 
     virtual int
-    sync();
+    sync() override;
 
   private:
     std::ostream& m_output;
diff --git a/src/util/time-custom-clock.hpp b/src/util/time-custom-clock.hpp
index 066d3e9..57579e5 100644
--- a/src/util/time-custom-clock.hpp
+++ b/src/util/time-custom-clock.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -37,9 +37,8 @@
 class CustomClock
 {
 public:
-  virtual ~CustomClock()
-  {
-  }
+  virtual
+  ~CustomClock() = default;
 
   virtual typename BaseClock::time_point
   getNow() const = 0;
diff --git a/src/util/time-unit-test-clock.hpp b/src/util/time-unit-test-clock.hpp
index d1bbe7d..253e1e7 100644
--- a/src/util/time-unit-test-clock.hpp
+++ b/src/util/time-unit-test-clock.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -27,7 +27,6 @@
 namespace ndn {
 namespace time {
 
-
 /**
  * @brief Traits for UnitTestClock, defining default behavior for different clocks
  *
@@ -42,7 +41,7 @@
   getDefaultStartTime()
   {
     return nanoseconds::zero();
-  };
+  }
 };
 
 /**
@@ -59,7 +58,7 @@
   getDefaultStartTime()
   {
     return seconds(1415684132);
-  };
+  }
 };
 
 /**
@@ -75,8 +74,7 @@
 {
 public:
   explicit
-  UnitTestClock(const nanoseconds& startTime =
-                UnitTestClockTraits<BaseClock>::getDefaultStartTime());
+  UnitTestClock(const nanoseconds& startTime = UnitTestClockTraits<BaseClock>::getDefaultStartTime());
 
   /**
    * @brief Advance unit test clock by @p duration
@@ -91,15 +89,14 @@
   setNow(const nanoseconds& timeSinceEpoch);
 
 public: // CustomClock<BaseClock>
-
   virtual std::string
-  getSince() const;
+  getSince() const override;
 
   virtual typename BaseClock::time_point
-  getNow() const;
+  getNow() const override;
 
   virtual boost::posix_time::time_duration
-  toPosixDuration(const typename BaseClock::duration& duration) const;
+  toPosixDuration(const typename BaseClock::duration& duration) const override;
 
 private:
   nanoseconds m_currentTime;