handler_config: Split out from buildjson
This allows us to build the version-handler without the json
infrastructure.
Change-Id: I8c0a5715cb66f6cbb3e72cb714759f6e11e3f409
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/bmc/buildjson.hpp b/bmc/buildjson.hpp
index d6b707e..f2b0ba1 100644
--- a/bmc/buildjson.hpp
+++ b/bmc/buildjson.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "fs.hpp"
-#include "image_handler.hpp"
+#include "handler_config.hpp"
#include "status.hpp"
#include <nlohmann/json.hpp>
@@ -24,31 +24,6 @@
std::unique_ptr<TriggerableActionInterface>
buildSystemd(const nlohmann::json& data);
-/**
- * HandlerConfig associates a blobID with an ImageHandler and a set of
- * supported actions of type T.
- */
-template <typename T>
-struct HandlerConfig
-{
- /* A string in the form: /flash/{unique}, s.t. unique is something like,
- * flash, ubitar, statictar, or bios
- */
- std::string blobId;
-
- /* This owns a handler interface, this is typically going to be a file
- * writer object.
- */
- std::unique_ptr<ImageHandlerInterface> handler;
-
- /* specifies actions to be taken in response to certain operations on a
- * blob.
- * Usually required but there are exceptions; the hashBlobId doesn't have
- * an action pack.
- */
- std::unique_ptr<T> actions;
-};
-
/* HandlersBuilderIfc is a helper class that builds Handlers from the json files
* found within a specified directory.
* The child class that inherits from HandlersBuilderIfc should implement
diff --git a/bmc/handler_config.hpp b/bmc/handler_config.hpp
new file mode 100644
index 0000000..d8e6cf3
--- /dev/null
+++ b/bmc/handler_config.hpp
@@ -0,0 +1,35 @@
+#pragma once
+#include "image_handler.hpp"
+
+#include <memory>
+#include <string>
+
+namespace ipmi_flash
+{
+
+/**
+ * HandlerConfig associates a blobID with an ImageHandler and a set of
+ * supported actions of type T.
+ */
+template <typename T>
+struct HandlerConfig
+{
+ /* A string in the form: /flash/{unique}, s.t. unique is something like,
+ * flash, ubitar, statictar, or bios
+ */
+ std::string blobId;
+
+ /* This owns a handler interface, this is typically going to be a file
+ * writer object.
+ */
+ std::unique_ptr<ImageHandlerInterface> handler;
+
+ /* specifies actions to be taken in response to certain operations on a
+ * blob.
+ * Usually required but there are exceptions; the hashBlobId doesn't have
+ * an action pack.
+ */
+ std::unique_ptr<T> actions;
+};
+
+} // namespace ipmi_flash
diff --git a/bmc/version-handler/test/version_mock.hpp b/bmc/version-handler/test/version_mock.hpp
index 80d3748..4cae248 100644
--- a/bmc/version-handler/test/version_mock.hpp
+++ b/bmc/version-handler/test/version_mock.hpp
@@ -1,4 +1,4 @@
-#include "buildjson.hpp"
+#include "handler_config.hpp"
#include "image_mock.hpp"
#include "triggerable_mock.hpp"
#include "version_handler.hpp"
diff --git a/bmc/version-handler/version_handler.cpp b/bmc/version-handler/version_handler.cpp
index 7cccf62..f2ab881 100644
--- a/bmc/version-handler/version_handler.cpp
+++ b/bmc/version-handler/version_handler.cpp
@@ -1,5 +1,11 @@
#include "version_handler.hpp"
+#include <algorithm>
+#include <cstring>
+#include <ios>
+#include <limits>
+#include <memory>
+#include <optional>
#include <utility>
#include <vector>
diff --git a/bmc/version-handler/version_handler.hpp b/bmc/version-handler/version_handler.hpp
index 128ec09..4a3d7d4 100644
--- a/bmc/version-handler/version_handler.hpp
+++ b/bmc/version-handler/version_handler.hpp
@@ -1,5 +1,5 @@
#pragma once
-#include "buildjson.hpp"
+#include "handler_config.hpp"
#include "image_handler.hpp"
#include "status.hpp"
#include "util.hpp"