From fd5d356c39eea3138bcb0d0cd1128642afc74a9c Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Fri, 29 May 2020 09:51:38 -0500 Subject: image: Support backend options --- image/backends/basic.hh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'image/backends/basic.hh') 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 +#include #include #include 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 &_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 opts; }; struct BackendDescriptor { - std::string type_code; - std::string description; - std::function creation_fn; + string type_code; + string description; + std::function &)> creation_fn; }; class BackendManager { -- cgit v1.2.3-60-g2f50