Expand conf namespace

Put rest of conf.hpp in the conf namespace. This is
largely a sed replace, and wrapping from_json in
conf namespace as it failed to build.

Change-Id: I9fe5c7b2fface44618c43af2367035afc39bcb64
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/pid/builder.cpp b/pid/builder.cpp
index 2faa1cc..1fbfbd4 100644
--- a/pid/builder.cpp
+++ b/pid/builder.cpp
@@ -36,8 +36,8 @@
 }
 
 std::unordered_map<int64_t, std::unique_ptr<PIDZone>>
-    buildZones(std::map<int64_t, PIDConf>& zonePids,
-               std::map<int64_t, struct ZoneConfig>& zoneConfigs,
+    buildZones(std::map<int64_t, conf::PIDConf>& zonePids,
+               std::map<int64_t, struct conf::ZoneConfig>& zoneConfigs,
                SensorManager& mgr, sdbusplus::bus::bus& modeControlBus)
 {
     std::unordered_map<int64_t, std::unique_ptr<PIDZone>> zones;
@@ -60,7 +60,7 @@
             throw std::runtime_error(err);
         }
 
-        const PIDConf& pidConfig = zi.second;
+        const conf::PIDConf& pidConfig = zi.second;
 
         auto zone = std::make_unique<PIDZone>(
             zoneId, zoneConf->second.minThermalOutput,
@@ -74,7 +74,7 @@
         {
             std::vector<std::string> inputs;
             std::string name = pit.first;
-            const struct ControllerInfo* info = &pit.second;
+            const struct conf::ControllerInfo* info = &pit.second;
 
             std::cerr << "PID name: " << name << "\n";
 
diff --git a/pid/builder.hpp b/pid/builder.hpp
index 2b28663..e500503 100644
--- a/pid/builder.hpp
+++ b/pid/builder.hpp
@@ -8,6 +8,6 @@
 #include <unordered_map>
 
 std::unordered_map<int64_t, std::unique_ptr<PIDZone>>
-    buildZones(std::map<int64_t, PIDConf>& zonePids,
-               std::map<int64_t, struct ZoneConfig>& zoneConfigs,
+    buildZones(std::map<int64_t, conf::PIDConf>& zonePids,
+               std::map<int64_t, struct conf::ZoneConfig>& zoneConfigs,
                SensorManager& mgr, sdbusplus::bus::bus& modeControlBus);
diff --git a/pid/buildjson.cpp b/pid/buildjson.cpp
index b620439..d31b6bc 100644
--- a/pid/buildjson.cpp
+++ b/pid/buildjson.cpp
@@ -24,7 +24,9 @@
 
 using json = nlohmann::json;
 
-void from_json(const json& j, ControllerInfo& c)
+namespace conf
+{
+void from_json(const json& j, conf::ControllerInfo& c)
 {
     j.at("type").get_to(c.type);
     j.at("inputs").get_to(c.inputs);
@@ -67,22 +69,24 @@
         j.at("negativeHysteresis").get_to(c.pidInfo.negativeHysteresis);
     }
 }
+} // namespace conf
 
-std::pair<std::map<int64_t, PIDConf>, std::map<int64_t, struct ZoneConfig>>
+std::pair<std::map<int64_t, conf::PIDConf>,
+          std::map<int64_t, struct conf::ZoneConfig>>
     buildPIDsFromJson(const json& data)
 {
     // zone -> pids
-    std::map<int64_t, PIDConf> pidConfig;
+    std::map<int64_t, conf::PIDConf> pidConfig;
     // zone -> configs
-    std::map<int64_t, struct ZoneConfig> zoneConfig;
+    std::map<int64_t, struct conf::ZoneConfig> zoneConfig;
 
     /* TODO: if zones is empty, that's invalid. */
     auto zones = data["zones"];
     for (const auto& zone : zones)
     {
         int64_t id;
-        PIDConf thisZone;
-        struct ZoneConfig thisZoneConfig;
+        conf::PIDConf thisZone;
+        struct conf::ZoneConfig thisZoneConfig;
 
         /* TODO: using at() throws a specific exception we can catch */
         id = zone["id"];
@@ -93,7 +97,7 @@
         for (const auto& pid : pids)
         {
             auto name = pid["name"];
-            auto item = pid.get<ControllerInfo>();
+            auto item = pid.get<conf::ControllerInfo>();
 
             thisZone[name] = item;
         }
diff --git a/pid/buildjson.hpp b/pid/buildjson.hpp
index 626c982..d4e86a7 100644
--- a/pid/buildjson.hpp
+++ b/pid/buildjson.hpp
@@ -14,5 +14,6 @@
  * @param[in] data - the json data
  * @return the pidConfig, and the zoneConfig
  */
-std::pair<std::map<int64_t, PIDConf>, std::map<int64_t, struct ZoneConfig>>
+std::pair<std::map<int64_t, conf::PIDConf>,
+          std::map<int64_t, struct conf::ZoneConfig>>
     buildPIDsFromJson(const json& data);