treewide: remove 'using namespace' from headers

Using namespace at global scope in a header file violates the cpp core
guidelines.  Quoting the guidelines:

  "Doing so takes away an #includer’s ability to effectively
disambiguate and to use alternatives. It also makes #included headers
order-dependent as they might have different meaning when included in
different orders."

For further reading:
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-using-directive

The guidelines don't call out using using namespace from namespace
scope, but it is only marginally less problematic and still unexpected,
so this patch removes those as well.

The process used to do the update is roughly:

1 - git grep 'using namespace' **.hpp
2 - For each instance, remove the offending 'using namespace' line
3 - build
4 - add 'using namespace' to cpp files or fully resolve types in hpp
  files until the project builds again.

Further cleanup is possible - for example cpp files could be scrubbed
for unnecessary namespace qualification - this was not done here to make
review as simple as possible.

Change-Id: I4931f5e78a1b5b74b4a4774c035a549f4d59b91a
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/requester/handler.hpp b/requester/handler.hpp
index 1bb9cc4..2af4ade 100644
--- a/requester/handler.hpp
+++ b/requester/handler.hpp
@@ -62,11 +62,6 @@
 
 using ResponseHandler = fu2::unique_function<void(
     mctp_eid_t eid, const pldm_msg* response, size_t respMsgLen)>;
-using namespace std::chrono;
-using namespace sdeventplus;
-using namespace sdeventplus::source;
-using namespace pldm::dbus_api;
-using namespace phosphor;
 
 /** @class Handler
  *
@@ -101,11 +96,12 @@
      *  @param[in] responseTimeOut - time to wait between each retry
      */
     explicit Handler(
-        int fd, Event& event, Requester& requester,
-        seconds instanceIdExpiryInterval =
-            seconds(INSTANCE_ID_EXPIRATION_INTERVAL),
+        int fd, sdeventplus::Event& event, pldm::dbus_api::Requester& requester,
+        std::chrono::seconds instanceIdExpiryInterval =
+            std::chrono::seconds(INSTANCE_ID_EXPIRATION_INTERVAL),
         uint8_t numRetries = static_cast<uint8_t>(NUMBER_OF_REQUEST_RETRIES),
-        milliseconds responseTimeOut = milliseconds(RESPONSE_TIME_OUT)) :
+        std::chrono::milliseconds responseTimeOut =
+            std::chrono::milliseconds(RESPONSE_TIME_OUT)) :
         fd(fd),
         event(event), requester(requester),
         instanceIdExpiryInterval(instanceIdExpiryInterval),
@@ -181,7 +177,8 @@
 
         try
         {
-            timer->start(duration_cast<microseconds>(instanceIdExpiryInterval));
+            timer->start(duration_cast<std::chrono::microseconds>(
+                instanceIdExpiryInterval));
         }
         catch (const std::runtime_error& e)
         {
@@ -237,19 +234,22 @@
     }
 
   private:
-    int fd;               //!< file descriptor of MCTP communications socket
-    Event& event;         //!< reference to PLDM daemon's main event loop
-    Requester& requester; //!< reference to Requester object
-    seconds instanceIdExpiryInterval; //!< Instance ID expiration interval
-    uint8_t numRetries;               //!< number of request retries
-    milliseconds responseTimeOut;     //!< time to wait between each retry
+    int fd; //!< file descriptor of MCTP communications socket
+    sdeventplus::Event& event; //!< reference to PLDM daemon's main event loop
+    pldm::dbus_api::Requester& requester; //!< reference to Requester object
+    std::chrono::seconds
+        instanceIdExpiryInterval; //!< Instance ID expiration interval
+    uint8_t numRetries;           //!< number of request retries
+    std::chrono::milliseconds
+        responseTimeOut; //!< time to wait between each retry
 
     /** @brief Container for storing the details of the PLDM request message,
      *         handler for the corresponding PLDM response and the timer object
      *         for the Instance ID expiration
      */
-    using RequestValue = std::tuple<std::unique_ptr<RequestInterface>,
-                                    ResponseHandler, std::unique_ptr<Timer>>;
+    using RequestValue =
+        std::tuple<std::unique_ptr<RequestInterface>, ResponseHandler,
+                   std::unique_ptr<phosphor::Timer>>;
 
     /** @brief Container for storing the PLDM request entries */
     std::unordered_map<RequestKey, RequestValue, RequestKeyHasher> handlers;
@@ -257,7 +257,8 @@
     /** @brief Container to store information about the request entries to be
      *         removed after the instance ID timer expires
      */
-    std::unordered_map<RequestKey, std::unique_ptr<Defer>, RequestKeyHasher>
+    std::unordered_map<RequestKey, std::unique_ptr<sdeventplus::source::Defer>,
+                       RequestKeyHasher>
         removeRequestContainer;
 
     /** @brief Remove request entry for which the instance ID expired
diff --git a/requester/request.hpp b/requester/request.hpp
index 6bb016d..f1a91d7 100644
--- a/requester/request.hpp
+++ b/requester/request.hpp
@@ -18,8 +18,6 @@
 namespace requester
 {
 
-using namespace std::chrono;
-
 /** @class RequestRetryTimer
  *
  *  The abstract base class for implementing the PLDM request retry logic. This
@@ -44,7 +42,7 @@
      *  @param[in] timeout - time to wait between each retry in milliseconds
      */
     explicit RequestRetryTimer(sdeventplus::Event& event, uint8_t numRetries,
-                               milliseconds timeout) :
+                               std::chrono::milliseconds timeout) :
 
         event(event),
         numRetries(numRetries), timeout(timeout),
@@ -67,7 +65,8 @@
         {
             if (numRetries)
             {
-                timer.start(duration_cast<microseconds>(timeout), true);
+                timer.start(duration_cast<std::chrono::microseconds>(timeout),
+                            true);
             }
         }
         catch (const std::runtime_error& e)
@@ -94,7 +93,8 @@
   protected:
     sdeventplus::Event& event; //!< reference to PLDM daemon's main event loop
     uint8_t numRetries;        //!< number of request retries
-    milliseconds timeout;  //!< time to wait between each retry in milliseconds
+    std::chrono::milliseconds
+        timeout;           //!< time to wait between each retry in milliseconds
     phosphor::Timer timer; //!< manages starting timers and handling timeouts
 
     /** @brief Sends the PLDM request message
@@ -147,7 +147,7 @@
      */
     explicit Request(int fd, mctp_eid_t eid, sdeventplus::Event& event,
                      pldm::Request&& requestMsg, uint8_t numRetries,
-                     milliseconds timeout) :
+                     std::chrono::milliseconds timeout) :
         RequestRetryTimer(event, numRetries, timeout),
         fd(fd), eid(eid), requestMsg(std::move(requestMsg))
     {}
diff --git a/requester/test/mock_request.hpp b/requester/test/mock_request.hpp
index b8e9efb..8b51a03 100644
--- a/requester/test/mock_request.hpp
+++ b/requester/test/mock_request.hpp
@@ -11,14 +11,12 @@
 namespace requester
 {
 
-using namespace std::chrono;
-
 class MockRequest : public RequestRetryTimer
 {
   public:
     MockRequest(int /*fd*/, mctp_eid_t /*eid*/, sdeventplus::Event& event,
                 pldm::Request&& /*requestMsg*/, uint8_t numRetries,
-                milliseconds responseTimeOut) :
+                std::chrono::milliseconds responseTimeOut) :
         RequestRetryTimer(event, numRetries, responseTimeOut)
     {}