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/sensors/buildjson.cpp b/sensors/buildjson.cpp
index d62edfd..42a9286 100644
--- a/sensors/buildjson.cpp
+++ b/sensors/buildjson.cpp
@@ -23,7 +23,9 @@
using json = nlohmann::json;
-void from_json(const json& j, SensorConfig& s)
+namespace conf
+{
+void from_json(const json& j, conf::SensorConfig& s)
{
j.at("type").get_to(s.type);
j.at("readPath").get_to(s.readPath);
@@ -72,11 +74,12 @@
j.at("timeout").get_to(s.timeout);
}
}
+} // namespace conf
-std::map<std::string, struct SensorConfig>
+std::map<std::string, struct conf::SensorConfig>
buildSensorsFromJson(const json& data)
{
- std::map<std::string, struct SensorConfig> config;
+ std::map<std::string, struct conf::SensorConfig> config;
auto sensors = data["sensors"];
/* TODO: If no sensors, this is invalid, and we should except here or during
@@ -84,7 +87,7 @@
*/
for (const auto& sensor : sensors)
{
- config[sensor["name"]] = sensor.get<struct SensorConfig>();
+ config[sensor["name"]] = sensor.get<struct conf::SensorConfig>();
}
return config;