Implement lazy function generation using function generation queue

This commit is contained in:
Kamil Śliwak
2020-04-17 13:28:07 +02:00
parent 1f28f79ae6
commit c7947c1af6
15 changed files with 91 additions and 164 deletions
@@ -41,10 +41,15 @@ public:
std::string createFunction(std::string const& _name, std::function<std::string()> const& _creator);
/// @returns concatenation of all generated functions.
/// Guarantees that the order of functions in the generated code is deterministic and
/// platform-independent.
/// Clears the internal list, i.e. calling it again will result in an
/// empty return value.
std::string requestedFunctions();
/// @returns true IFF a function with the specified name has already been collected.
bool contains(std::string const& _name) const { return m_requestedFunctions.count(_name) > 0; }
private:
/// Map from function name to code for a multi-use function.
std::map<std::string, std::string> m_requestedFunctions;