summaryrefslogtreecommitdiff
path: root/include/gras/factory.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/gras/factory.hpp')
-rw-r--r--include/gras/factory.hpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/include/gras/factory.hpp b/include/gras/factory.hpp
index fd03bb3..819877c 100644
--- a/include/gras/factory.hpp
+++ b/include/gras/factory.hpp
@@ -6,24 +6,28 @@
#include <gras/gras.hpp>
#include <gras/element.hpp>
#include <PMC/PMC.hpp>
+#include <vector>
#include <string>
namespace gras
{
/*!
- * Element factory:
- * - Register factory functions into the global factory.
- * - Call make() to create element from global factory.
+ * The just in time factory:
+ * Compile a C++ source and load it into the element factory.
+ *
+ * Flags are an optional list of compiler flags.
+ * See the man page for clang for possible options.
+ * Example: flags.push_back("-O3")
+ *
+ * Include directories control the header file search path.
+ * Users may leave this empty unless headers
+ * are installed into non-standard directories.
+ *
+ * \param source C++ source code in a string
+ * \param flags optional compiler flags
*/
-struct GRAS_API Factory
-{
- /*******************************************************************
- * Private registration hooks
- ******************************************************************/
- static void _register_factory(const std::string &, void *);
- static Element *_handle_make(const std::string &, const PMCC &);
-};
+GRAS_API void jit_factory(const std::string &source, const std::vector<std::string> &flags);
/***********************************************************************
* Register API - don't look here, template magic, not helpful
@@ -101,6 +105,12 @@ static Element *make(const std::string &path, const A0 &, const A1 &, const A2 &
template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
static Element *make(const std::string &path, const A0 &, const A1 &, const A2 &, const A3 &, const A4 &, const A5 &, const A6 &, const A7 &, const A8 &, const A9 &);
+
+//! Register factory functions into the global factory.
+GRAS_API void _register_factory(const std::string &, void *);
+
+//! Call make() to create element from global factory.
+GRAS_API Element *_handle_make(const std::string &, const PMCC &);
}
/*!