summaryrefslogtreecommitdiff
path: root/image/backends/basic.hh
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-05-29 09:51:38 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-05-29 09:51:38 -0500
commitfd5d356c39eea3138bcb0d0cd1128642afc74a9c (patch)
treeeeefeb8c116094ca3131b1c2c5d24872266ff621 /image/backends/basic.hh
parent30b9f32d7a544f50f5e06ef930525d620a028db1 (diff)
downloadhorizon-fd5d356c39eea3138bcb0d0cd1128642afc74a9c.tar.gz
horizon-fd5d356c39eea3138bcb0d0cd1128642afc74a9c.tar.bz2
horizon-fd5d356c39eea3138bcb0d0cd1128642afc74a9c.tar.xz
horizon-fd5d356c39eea3138bcb0d0cd1128642afc74a9c.zip
image: Support backend options
Diffstat (limited to 'image/backends/basic.hh')
-rw-r--r--image/backends/basic.hh22
1 files changed, 15 insertions, 7 deletions
diff --git a/image/backends/basic.hh b/image/backends/basic.hh
index d57a9ac..ff92ec8 100644
--- a/image/backends/basic.hh
+++ b/image/backends/basic.hh
@@ -13,20 +13,25 @@
#pragma once
#include <functional>
+#include <map>
#include <string>
#include <vector>
namespace Horizon {
namespace Image {
+using std::string;
+
class BasicBackend {
public:
/*! Create the backend object.
* @param _ir_dir The intermediate directory the image should contain.
* @param _out_path The path to write the image.
+ * @param _opts Options, if any.
*/
- BasicBackend(const std::string &_ir_dir, const std::string &_out_path) :
- ir_dir(_ir_dir), out_path(_out_path) {};
+ BasicBackend(const string &_ir_dir, const string &_out_path,
+ const std::map<string, string> &_opts = {}) :
+ ir_dir{_ir_dir}, out_path{_out_path}, opts{_opts} {};
virtual ~BasicBackend() {};
/*! Prepare for creating the image.
@@ -47,15 +52,18 @@ public:
/*! The intermediate directory which contains the sysroot the image
* should contain. */
- const std::string ir_dir;
+ const string ir_dir;
/*! The path at which to write the image. */
- const std::string out_path;
+ const string out_path;
+ /*! Backend-specific configuration options. */
+ const std::map<string, string> opts;
};
struct BackendDescriptor {
- std::string type_code;
- std::string description;
- std::function<BasicBackend *(std::string, std::string)> creation_fn;
+ string type_code;
+ string description;
+ std::function<BasicBackend *(const string &, const string &,
+ const std::map<string, string> &)> creation_fn;
};
class BackendManager {